Skip to content

Commit 4887fbf

Browse files
committed
Fixed: #2354 Simplify expressions problems in some cases
1 parent 326e0b0 commit 4887fbf

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
1818
- FLA export - DefineEditText default text color alpha
1919
- Text display - Alpha channel should not be supported for texts using device fonts
2020
- [#2192] Long script lines are now wrapped (1000 chars limit by default) to avoid problems on Linux
21+
- [#2354] Simplify expressions problems in some cases
2122

2223
## [21.1.1] - 2024-10-13
2324
### Added
@@ -3625,6 +3626,7 @@ Major version of SWF to XML export changed to 2.
36253626
[#2341]: https://www.free-decompiler.com/flash/issues/2341
36263627
[#2345]: https://www.free-decompiler.com/flash/issues/2345
36273628
[#2192]: https://www.free-decompiler.com/flash/issues/2192
3629+
[#2354]: https://www.free-decompiler.com/flash/issues/2354
36283630
[#2321]: https://www.free-decompiler.com/flash/issues/2321
36293631
[#2305]: https://www.free-decompiler.com/flash/issues/2305
36303632
[#2328]: https://www.free-decompiler.com/flash/issues/2328

libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,10 @@ public void handleSetProperty(boolean init, AVM2LocalData localData, TranslateSt
709709
}
710710
if (getProperty.object instanceof SetLocalAVM2Item) {
711711
SetLocalAVM2Item objSetLocalReg = (SetLocalAVM2Item) getProperty.object;
712-
712+
713713
if ((valueLocalReg.regIndex == valueSetLocalReg.regIndex)
714714
&& (propertyName.multinameIndex == multinameIndex)
715-
&& ((nameLocalReg == null && nameSetLocalReg == null) || (nameLocalReg.regIndex == nameSetLocalReg.regIndex))
715+
&& ((nameLocalReg == null && nameSetLocalReg == null) || (nameLocalReg != null && nameSetLocalReg != null && nameLocalReg.regIndex == nameSetLocalReg.regIndex))
716716
&& (objLocalReg.regIndex == objSetLocalReg.regIndex)) {
717717
if (nameSetLocalReg != null) {
718718
propertyName.name = nameSetLocalReg.value;

libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,14 @@ public BinaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem,
9292
@Override
9393
public GraphTargetItem simplify(String implicitCoerce) {
9494
BinaryOpItem r = (BinaryOpItem) clone();
95-
r.leftSide = r.leftSide.simplify(coerceLeft);
95+
r.leftSide = r.leftSide.simplify(coerceLeft);
9696
r.rightSide = r.rightSide.simplify(coerceRight);
97+
98+
if (r.leftSide == this.leftSide
99+
&& r.rightSide == this.rightSide) {
100+
r = this;
101+
}
102+
97103
return simplifySomething(r, implicitCoerce);
98104
}
99105

libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public UnaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, i
6161
public GraphTargetItem simplify(String implicitCoerce) {
6262
GraphTargetItem r = clone();
6363
r.value = r.value.simplify(coerce);
64+
if (r.value == this.value) {
65+
r = this;
66+
}
6467
return simplifySomething(r, implicitCoerce);
6568
}
6669

0 commit comments

Comments
 (0)