mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-29 11:06:07 +00:00
AS3 direct editation: Or coercion fix
This commit is contained in:
@@ -20,10 +20,12 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.OrItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,6 +37,15 @@ public abstract class AssignableAVM2Item extends AVM2Item {
|
||||
|
||||
protected GraphTargetItem assignedValue;
|
||||
|
||||
protected GraphTargetItem makeCoerced(GraphTargetItem assignedValue, GraphTargetItem targetType) {
|
||||
if (assignedValue instanceof OrItem) {
|
||||
OrItem oi = (OrItem) assignedValue;
|
||||
return new OrItem(assignedValue.getSrc(), makeCoerced(oi.leftSide, targetType), makeCoerced(oi.rightSide, targetType));
|
||||
}
|
||||
//TODO: Is it needed for AndItem too?
|
||||
return new CoerceAVM2Item(null, assignedValue, targetType);
|
||||
}
|
||||
|
||||
public AssignableAVM2Item() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.other.FindPropertyStrictIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.ApplyTypeAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.model.InitVectorAVM2Item;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
@@ -582,7 +581,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
String srcType = assignedValue.returnType().toString();
|
||||
GraphTargetItem coerced = assignedValue;
|
||||
if (!targetType.toString().equals(srcType) && !propertyName.startsWith("@")) {
|
||||
coerced = new CoerceAVM2Item(null, assignedValue, targetType);
|
||||
coerced = makeCoerced(assignedValue, targetType);
|
||||
}
|
||||
return toSourceMerge(localData, generator, obj, coerced,
|
||||
needsReturn ? dupSetTemp(localData, generator, ret_temp) : null,
|
||||
|
||||
Reference in New Issue
Block a user