diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 4aca29fc2..018f58619 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -193,7 +193,7 @@ public class ActionPush extends Action { case ASMParsedSymbol.TYPE_COMMENT: break; default: - throw new ParseException("Arguments expected", lexer.yyline()); + throw new ParseException("Arguments expected, "+symb.type+" "+symb.value+" found", lexer.yyline()); } @@ -289,7 +289,7 @@ public class ActionPush extends Action { o = constantPool.get(((ConstantIndex) o).index); } } - if (o instanceof RegisterNumber) { + /*if (o instanceof RegisterNumber) { if (regNames.containsKey(((RegisterNumber) o).number)) { ((RegisterNumber) o).name = regNames.get(((RegisterNumber) o).number); } else if (output.size() >= 2) { //chained assignments:, ignore for class prototype assignment @@ -306,7 +306,8 @@ public class ActionPush extends Action { } else if ((stt.getValue() instanceof DecrementTreeItem) && (((DecrementTreeItem) stt.getValue()).object.equals(stt.getObject()))) { stack.push(new PreDecrementTreeItem(this, stt.getObject())); } else { - stack.push(last); + //stack.push(last); + continue; } output.remove(output.size() - 1); output.remove(output.size() - 1); @@ -316,7 +317,7 @@ public class ActionPush extends Action { } } } - } + }*/ DirectValueTreeItem dvt = new DirectValueTreeItem(this, pos, o, constantPool); stack.push(dvt); if (o instanceof RegisterNumber) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java index da2abf482..5b6c098eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.treemodel.IncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostDecrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostIncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.SetPropertyTreeItem; +import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; @@ -70,6 +71,9 @@ public class ActionSetProperty extends Action { } } } + if(value instanceof StoreRegisterTreeItem){ + ((StoreRegisterTreeItem)value).define=false; + } output.add(new SetPropertyTreeItem(this, target, indexInt, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java index 5e0c4b251..964168f39 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.treemodel.IncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostDecrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostIncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.SetVariableTreeItem; +import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.util.HashMap; @@ -82,6 +83,9 @@ public class ActionSetVariable extends Action { } } } + if(value instanceof StoreRegisterTreeItem){ + ((StoreRegisterTreeItem)value).define=false; + } SetVariableTreeItem svt = new SetVariableTreeItem(this, name, value); output.add(svt); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java index d85dcbe53..0f66345e1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.treemodel.IncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostDecrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.PostIncrementTreeItem; import com.jpexs.decompiler.flash.action.treemodel.SetMemberTreeItem; +import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; @@ -85,6 +86,9 @@ public class ActionSetMember extends Action { } } } + if(value instanceof StoreRegisterTreeItem){ + ((StoreRegisterTreeItem)value).define=false; + } output.add(new SetMemberTreeItem(this, object, memberName, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java index 6eecaeda7..00da133c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; +import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; import com.jpexs.decompiler.flash.graph.GraphTargetItem; @@ -69,7 +70,7 @@ public class ActionStoreRegister extends Action { @Override public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions) { - GraphTargetItem item = stack.peek(); + GraphTargetItem item = stack.pop(); RegisterNumber rn = new RegisterNumber(registerNumber); if (regNames.containsKey(registerNumber)) { rn.name = regNames.get(registerNumber); @@ -77,6 +78,20 @@ public class ActionStoreRegister extends Action { item.moreSrc.add(new GraphSourceItemPos(this, 0)); boolean define = !variables.containsKey("__register" + registerNumber); variables.put("__register" + registerNumber, item); - output.add(new StoreRegisterTreeItem(this, rn, item, define)); + if(item instanceof DirectValueTreeItem){ + if(((DirectValueTreeItem)item).value instanceof RegisterNumber){ + if(((RegisterNumber)((DirectValueTreeItem)item).value).number==registerNumber){ + stack.push(item); + return; + } + } + } + if(item instanceof StoreRegisterTreeItem){ + if(((StoreRegisterTreeItem)item).register.number==registerNumber){ + stack.push(item); + return; + } + } + stack.push(new StoreRegisterTreeItem(this, rn, item, define)); } }