diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java index 6226a5dd5..3932ef8a5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java @@ -21,6 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.DeletePropertyIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; +import com.jpexs.decompiler.flash.abc.avm2.parser.script.PropertyAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.parser.script.UnresolvedAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -35,6 +37,14 @@ public class DeletePropertyAVM2Item extends AVM2Item { public GraphTargetItem object; public GraphTargetItem propertyName; + private int line; + + //Constructor for compiler + public DeletePropertyAVM2Item(GraphTargetItem property, int line) { + this(null, property, null); + this.line = line; + } + public DeletePropertyAVM2Item(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem propertyName) { super(instruction, PRECEDENCE_UNARY); this.object = object; @@ -52,8 +62,18 @@ public class DeletePropertyAVM2Item extends AVM2Item { @Override public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { - return toSourceMerge(localData, generator, object, - new AVM2Instruction(0, new DeletePropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)}, new byte[0]) + GraphTargetItem p = object; + if (p instanceof UnresolvedAVM2Item) { + p = ((UnresolvedAVM2Item) p).resolved; + } + if (!(p instanceof PropertyAVM2Item)) { + throw new CompilationException("Not a property", line); //TODO: handle line better way + } + + PropertyAVM2Item prop = (PropertyAVM2Item) p; + + return toSourceMerge(localData, generator, prop.object, + ins(new DeletePropertyIns(), prop.resolveProperty(localData)) ); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index 9c1b8000b..469a5d425 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -1723,12 +1723,7 @@ public class ActionScriptParser { if (!isNameOrProp(varDel)) { throw new ParseException("Not a property or name", lexer.yyline()); } - if (varDel instanceof GetPropertyAVM2Item) { - GetPropertyAVM2Item gm = (GetPropertyAVM2Item) varDel; - ret = new DeletePropertyAVM2Item(null, gm.object, gm.propertyName); - } else { - throw new ParseException("Not a property", lexer.yyline()); - } + ret = new DeletePropertyAVM2Item(varDel, lexer.yyline()); break; case INCREMENT: case DECREMENT: //preincrement diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt index 784f23c23..717246fe8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt @@ -3,6 +3,5 @@ TODO List for AS3 parser/compiler: - E4X (XML) - typenames (Vectors) - inner function names -- delete property - default xml namespace - custom namespace modifiers \ No newline at end of file