Call ins dup fix

This commit is contained in:
Jindra Petřík
2025-08-31 10:14:55 +02:00
parent 70691e55ff
commit a9daa5925f

View File

@@ -32,6 +32,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import com.jpexs.decompiler.graph.model.DuplicateItem;
import com.jpexs.decompiler.graph.model.DuplicateSourceItem;
import com.jpexs.decompiler.graph.model.SetTemporaryItem;
import java.util.ArrayList;
import java.util.List;
@@ -88,12 +89,19 @@ public class CallIns extends InstructionDefinition {
if (function instanceof GetPropertyAVM2Item) {
GetPropertyAVM2Item getProperty = (GetPropertyAVM2Item) function;
if (getProperty.object instanceof DuplicateItem) {
DuplicateItem d = (DuplicateItem) getProperty.object;
if (getProperty.object.value == receiver.getThroughDuplicate()) {
getProperty.object = receiver.getThroughDuplicate();
}
if (receiver instanceof DuplicateSourceItem) {
receiver = receiver.getThroughDuplicate();
}
if (!output.isEmpty() && output.get(output.size() - 1) instanceof SetTemporaryItem) {
SetTemporaryItem st = (SetTemporaryItem) output.get(output.size() - 1);
if (st.tempIndex == d.tempIndex) {
output.remove(output.size() - 1);
}
}
} else if (getProperty.object instanceof SetLocalAVM2Item) {
SetLocalAVM2Item setLocal = (SetLocalAVM2Item) getProperty.object;
if (receiver instanceof LocalRegAVM2Item) {