diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b5a718ae..c2d34a843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - #1101 AS3 direct editation - handling imported vars - #1169 AS1/2 direct editation - getmember after new operator - #1338, #1480 AS3 direct editation - Vector in combination with activation +- AS3 decompilation - do not show setslot on activation when has same name as method parameter ### Changed - #1616 Close SWF menuitem is last in the context menu diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index ee933a082..46eadb83a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -60,6 +60,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.InAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NewActivationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NextNameAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NextValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ReturnValueAVM2Item; @@ -1915,6 +1916,33 @@ public class AVM2Graph extends Graph { } } + if (level == 0) { + Map localRegNames = body.getLocalRegNames(abc); + loopi: + for (int i = 0; i < list.size(); i++) { + if (list.get(i) instanceof SetSlotAVM2Item) { + SetSlotAVM2Item sslot = (SetSlotAVM2Item) list.get(0); + if (sslot.slotObject instanceof NewActivationAVM2Item) { + String slotName = sslot.slotName.getName(abc.constants, new ArrayList<>(), true, true); + if (sslot.value.getNotCoercedNoDup() instanceof LocalRegAVM2Item) { + LocalRegAVM2Item locReg = (LocalRegAVM2Item) sslot.value.getNotCoercedNoDup(); + if (localRegNames.containsValue(slotName)) { + for (int regIndex : localRegNames.keySet()) { + if (slotName.equals(localRegNames.get(regIndex))) { + if (locReg.regIndex == regIndex) { + list.remove(i); + i--; + continue loopi; + } + } + } + } + } + } + } + } + } + for (int i = 0; i < list.size(); i++) { if (list.get(i) instanceof WithAVM2Item) {