diff --git a/CHANGELOG.md b/CHANGELOG.md index ded902ed7..1f066e03e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java index 3f9b7c320..0a74c4b41 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java @@ -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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java index 221009155..d527a9fb0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java @@ -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); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java index b158641ef..1a9f2fe33 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java @@ -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); }