Fixed: AS3 decompilation - do not show setslot on activation when has same name as method parameter

This commit is contained in:
Jindra Petřík
2021-02-26 09:46:17 +01:00
parent d808d71e04
commit 6ea5df56b9
2 changed files with 29 additions and 0 deletions

View File

@@ -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

View File

@@ -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<Integer, String> 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) {