Fixed: #2354 Simplify expressions problems in some cases

This commit is contained in:
Jindra Petřík
2024-10-26 21:27:53 +02:00
parent 79765e07a8
commit f6010cf7ed
4 changed files with 14 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
- FLA export - DefineEditText default text color alpha
- Text display - Alpha channel should not be supported for texts using device fonts
- [#2192] Long script lines are now wrapped (1000 chars limit by default) to avoid problems on Linux
- [#2354] Simplify expressions problems in some cases
## [21.1.1] - 2024-10-13
### Added
@@ -3625,6 +3626,7 @@ Major version of SWF to XML export changed to 2.
[#2341]: https://www.free-decompiler.com/flash/issues/2341
[#2345]: https://www.free-decompiler.com/flash/issues/2345
[#2192]: https://www.free-decompiler.com/flash/issues/2192
[#2354]: https://www.free-decompiler.com/flash/issues/2354
[#2321]: https://www.free-decompiler.com/flash/issues/2321
[#2305]: https://www.free-decompiler.com/flash/issues/2305
[#2328]: https://www.free-decompiler.com/flash/issues/2328

View File

@@ -709,10 +709,10 @@ public abstract class InstructionDefinition implements Serializable {
}
if (getProperty.object instanceof SetLocalAVM2Item) {
SetLocalAVM2Item objSetLocalReg = (SetLocalAVM2Item) getProperty.object;
if ((valueLocalReg.regIndex == valueSetLocalReg.regIndex)
&& (propertyName.multinameIndex == multinameIndex)
&& ((nameLocalReg == null && nameSetLocalReg == null) || (nameLocalReg.regIndex == nameSetLocalReg.regIndex))
&& ((nameLocalReg == null && nameSetLocalReg == null) || (nameLocalReg != null && nameSetLocalReg != null && nameLocalReg.regIndex == nameSetLocalReg.regIndex))
&& (objLocalReg.regIndex == objSetLocalReg.regIndex)) {
if (nameSetLocalReg != null) {
propertyName.name = nameSetLocalReg.value;

View File

@@ -92,8 +92,14 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
@Override
public GraphTargetItem simplify(String implicitCoerce) {
BinaryOpItem r = (BinaryOpItem) clone();
r.leftSide = r.leftSide.simplify(coerceLeft);
r.leftSide = r.leftSide.simplify(coerceLeft);
r.rightSide = r.rightSide.simplify(coerceRight);
if (r.leftSide == this.leftSide
&& r.rightSide == this.rightSide) {
r = this;
}
return simplifySomething(r, implicitCoerce);
}

View File

@@ -61,6 +61,9 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
public GraphTargetItem simplify(String implicitCoerce) {
GraphTargetItem r = clone();
r.value = r.value.simplify(coerce);
if (r.value == this.value) {
r = this;
}
return simplifySomething(r, implicitCoerce);
}