diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 6df6435d7..2bd36c881 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.IgnoredPair; import com.jpexs.decompiler.flash.action.parser.ASMParser; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.special.ActionNop; @@ -27,7 +26,8 @@ import com.jpexs.decompiler.flash.action.swf5.*; import com.jpexs.decompiler.flash.action.swf6.*; import com.jpexs.decompiler.flash.action.swf7.*; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.*; @@ -494,7 +494,7 @@ public class SWFInputStream extends InputStream { List retdups = new ArrayList(); ConstantPool cpool = null; - Stack stack = new Stack(); + Stack stack = new Stack(); ReReadableInputStream rri = new ReReadableInputStream(this); SWFInputStream sis = new SWFInputStream(rri, version); @@ -516,12 +516,12 @@ public class SWFInputStream extends InputStream { return ret; } - private void readActionListAtPos(Stack stack, ConstantPool cpool, SWFInputStream sis, ReReadableInputStream rri, int ip, List ret) throws IOException { + private void readActionListAtPos(Stack stack, ConstantPool cpool, SWFInputStream sis, ReReadableInputStream rri, int ip, List ret) throws IOException { boolean debugMode = false; boolean displayCompiletime = false; rri.setPos(ip); Action a; - List output = new ArrayList(); + List output = new ArrayList(); long filePos = rri.getPos(); while ((a = sis.readAction()) != null) { if (debugMode) { @@ -563,7 +563,7 @@ public class SWFInputStream extends InputStream { boolean goaif = false; if (a instanceof ActionIf) { aif = (ActionIf) a; - TreeItem top = stack.pop(); + GraphTargetItem top = stack.pop(); if (top.isCompileTime()) { if (debugMode) { System.out.print("is compiletime -> "); @@ -584,18 +584,18 @@ public class SWFInputStream extends InputStream { if (displayCompiletime) { beforeInsert = new ActionPop(); } else { - List needed = top.getNeededActions(); - for (IgnoredPair ig : needed) { - if (ig.action instanceof ActionPush) { - if (!((ActionPush) ig.action).ignoredParts.contains(ig.pos)) { - ((ActionPush) ig.action).ignoredParts.add(ig.pos); + List needed = top.getNeededSources(); + for (GraphSourceItemPos ig : needed) { + if (ig.item instanceof ActionPush) { + if (!((ActionPush) ig.item).ignoredParts.contains(ig.pos)) { + ((ActionPush) ig.item).ignoredParts.add(ig.pos); - if (((ActionPush) ig.action).ignoredParts.size() == ((ActionPush) ig.action).values.size()) { - ig.action.ignored = true; + if (((ActionPush) ig.item).ignoredParts.size() == ((ActionPush) ig.item).values.size()) { + ((Action) ig.item).ignored = true; } } } else { - ig.action.ignored = true; + ((Action) ig.item).ignored = true; } } } @@ -607,7 +607,7 @@ public class SWFInputStream extends InputStream { newip = rri.getPos() + ((ActionJump) a).offset; rri.setPos(newip); } else { - a.translate(stack, output, new HashMap()); + a.translate(Helper.toList(new HashMap()), stack, output); } for (int i = 0; i < actionLen; i++) { ensureCapacity(ret, ip + i); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 4ba3cf391..7d97d7f94 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -41,8 +41,6 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.ASM3Parser; import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; import com.jpexs.decompiler.flash.abc.avm2.treemodel.*; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.*; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AndTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.OrTreeItem; import com.jpexs.decompiler.flash.abc.types.ABCException; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; @@ -50,6 +48,7 @@ import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.Traits; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.io.*; @@ -820,11 +819,11 @@ public class AVM2Code implements Serializable { cacheActual = false; } - public static String listToString(List stack, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { + public static String listToString(List stack, ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { StringBuffer ret = new StringBuffer(); for (int d = 0; d < stack.size(); d++) { - TreeItem o = stack.get(d); - ret.append(o.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"); + GraphTargetItem o = stack.get(d); + ret.append(o.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n"); } return ret.toString(); } @@ -1032,7 +1031,7 @@ public class AVM2Code implements Serializable { return pos2adr(fixIPAfterDebugLine(adr2pos(addr))); } - public ConvertOutput toSourceOutput(boolean processJumps, boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, int start, int end, HashMap localRegNames, List fullyQualifiedNames, boolean visited[]) throws ConvertException { + public ConvertOutput toSourceOutput(boolean processJumps, boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, int start, int end, HashMap localRegNames, List fullyQualifiedNames, boolean visited[]) throws ConvertException { boolean debugMode = DEBUG_MODE; if (debugMode) { System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); @@ -1047,7 +1046,7 @@ public class AVM2Code implements Serializable { throw new ConvertException("Limit of subs(" + toSourceLimit + ") was reached", start); } } - List output = new ArrayList(); + List output = new ArrayList(); String ret = ""; int ip = start; try { @@ -1086,7 +1085,7 @@ public class AVM2Code implements Serializable { int endpos = adr2pos(fixAddrAfterDebugLine(catchedExceptions.get(0).end)); - List> catchedCommands = new ArrayList>(); + List> catchedCommands = new ArrayList>(); if (code.get(endpos).definition instanceof JumpIns) { int afterCatchAddr = pos2adr(endpos + 1) + code.get(endpos).operands[0]; int afterCatchPos = adr2pos(afterCatchAddr); @@ -1101,7 +1100,7 @@ public class AVM2Code implements Serializable { }); - List finallyCommands = new ArrayList(); + List finallyCommands = new ArrayList(); int returnPos = afterCatchPos; for (int e = 0; e < body.exceptions.length; e++) { if (body.exceptions[e].isFinally()) { @@ -1143,12 +1142,12 @@ public class AVM2Code implements Serializable { } else { eendpos = afterCatchPos - 1; } - Stack substack = new Stack(); + Stack substack = new Stack(); substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); - catchedCommands.add(toSourceOutput(processJumps, isStatic, classIndex, localRegs, substack, new Stack(), abc, constants, method_info, body, adr2pos(fixAddrAfterDebugLine(catchedExceptions.get(e).target)), eendpos, localRegNames, fullyQualifiedNames, visited).output); + catchedCommands.add(toSourceOutput(processJumps, isStatic, classIndex, localRegs, substack, new Stack(), abc, constants, method_info, body, adr2pos(fixAddrAfterDebugLine(catchedExceptions.get(e).target)), eendpos, localRegNames, fullyQualifiedNames, visited).output); } - List tryCommands = toSourceOutput(processJumps, isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, ip, endpos - 1, localRegNames, fullyQualifiedNames, visited).output; + List tryCommands = toSourceOutput(processJumps, isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, ip, endpos - 1, localRegNames, fullyQualifiedNames, visited).output; output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); @@ -1220,358 +1219,11 @@ public class AVM2Code implements Serializable { } } - if (ins.definition instanceof JumpIns) { //Ifs with multiple conditions - int secondAddr = addr + ins.getBytes().length; - int jumpAddr = secondAddr + ins.operands[0]; - int jumpPos = adr2pos(jumpAddr); - if (ins.operands[0] == 0) { - ip++; - } else if (ins.operands[0] > 0) { - if (finallyJumps.contains(jumpPos)) { - if (code.get(ip + 1).definition instanceof LabelIns) { - if (code.get(ip + 2).definition instanceof PopIns) { - if (code.get(ip + 3).definition instanceof LabelIns) { - if (code.get(ip + 4).definition instanceof GetLocalTypeIns) { - if (code.get(ip - 1).definition instanceof PushByteIns) { - if (code.get(ip - 2).definition instanceof SetLocalTypeIns) { - if (((SetLocalTypeIns) code.get(ip - 2).definition).getRegisterId(code.get(ip - 2)) == ((GetLocalTypeIns) code.get(ip + 4).definition).getRegisterId(code.get(ip + 4))) { - SetLocalTreeItem ti = (SetLocalTreeItem) output.remove(output.size() - 1); - stack.add(ti.value); - ip = ip + 5; - continue; - } - } - } - } - } - } - } - //continue; - ip++; - continue; - } - for (Loop l : loopList) { - if (l.loopBreak == jumpPos) { - output.add(new BreakTreeItem(ins, l.loopBreak)); - ip = ip + 1; - continue iploop; - } - if (l.loopContinue == jumpPos) { - l.continueCount++; - output.add(new ContinueTreeItem(ins, l.loopBreak)); - ip = ip + 1; - continue iploop; - } - } - - - boolean backJumpFound = false; - int afterBackJumpAddr = 0; - AVM2Instruction backJumpIns = null; - boolean isSwitch = false; - int switchPos = 0; - loopj: - for (int j = jumpPos; j <= end; j++) { - if (code.get(j).definition instanceof IfTypeIns) { - afterBackJumpAddr = pos2adr(j + 1); - - if (afterBackJumpAddr + code.get(j).operands[0] == secondAddr) { - backJumpFound = true; - backJumpIns = code.get(j); - break; - } - } - if (code.get(j).definition instanceof LookupSwitchIns) { - for (int h = 2; h < code.get(j).operands.length; h++) { - int ofs = code.get(j).operands[h] + pos2adr(j); - if (ofs == secondAddr) { - isSwitch = true; - switchPos = j; - break loopj; - } - } - } - } - if (isSwitch) { - AVM2Instruction killIns = code.get(switchPos - 1); - if (!(killIns.definition instanceof KillIns)) { - throw new ConvertException("Unknown pattern: no kill before lookupswitch", switchPos - 1); - } - int userReg = killIns.operands[0]; - int evalTo = -1; - for (int g = jumpPos; g < switchPos; g++) { - if ((code.get(g).definition instanceof SetLocal0Ins) && (userReg == 0)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal1Ins) && (userReg == 1)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal2Ins) && (userReg == 2)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal3Ins) && (userReg == 3)) { - evalTo = g; - break; - } - if ((code.get(g).definition instanceof SetLocalIns) && (userReg == code.get(g).operands[0])) { - evalTo = g; - break; - } - } - if (evalTo == -1) { - throw new ConvertException("Unknown pattern: no setlocal before lookupswitch", switchPos); - } - loopList.add(new Loop(ip, switchPos + 1)); - Stack substack = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, evalTo - 1, localRegNames, fullyQualifiedNames, visited).stack; - TreeItem switchedValue = substack.pop(); - //output.add("loop" + (switchPos + 1) + ":"); - int switchBreak = switchPos + 1; - List casesList = new ArrayList(); - List> caseCommands = new ArrayList>(); - List defaultCommands = new ArrayList(); - //output.add("switch(" + switchedValue + ")"); - //output.add("{"); - int curPos = evalTo + 1; - int casePos = 0; - do { - evalTo = -1; - for (int g = curPos; g < switchPos; g++) { - if ((code.get(g).definition instanceof GetLocal0Ins) && (userReg == 0)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal1Ins) && (userReg == 1)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal2Ins) && (userReg == 2)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal3Ins) && (userReg == 3)) { - evalTo = g; - break; - } - if ((code.get(g).definition instanceof GetLocalIns) && (userReg == code.get(g).operands[0])) { - evalTo = g; - break; - } - } - - - if (evalTo > -1) { - substack = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, curPos, evalTo - 1, localRegNames, fullyQualifiedNames, visited).stack; - casesList.add(substack.pop()); - } - int substart = adr2pos(code.get(switchPos).operands[2 + casePos] + pos2adr(switchPos)); - int subend = jumpPos - 1; - if (casePos + 1 < code.get(switchPos).operands.length - 2) { - subend = adr2pos(code.get(switchPos).operands[2 + casePos + 1] + pos2adr(switchPos)) - 1; - } - - if (evalTo == -1) { - subend--; - } - List commands = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, substart, subend, localRegNames, fullyQualifiedNames, visited).output; - if ((evalTo == -1) && (casePos + 1 < code.get(switchPos).operands.length - 2)) { - if (commands.size() == 1) { - commands.remove(0); - } - if (commands.size() > 0) { - //hasDefault=true; - } - } - List caseCommandPart = new ArrayList(); - if (evalTo == -1) { - defaultCommands.addAll(commands); - } else { - caseCommandPart.addAll(commands); - caseCommands.add(caseCommandPart); - } - curPos = evalTo + 4; - casePos++; - if (evalTo == -1) { - break; - } - } while (true); - if (processJumps) { - List valMapping = new ArrayList(); - for (int i = 0; i < casesList.size(); i++) { - valMapping.add(i); - } - output.add(new SwitchTreeItem(code.get(switchPos), switchBreak, switchedValue, casesList, caseCommands, defaultCommands, valMapping)); - } - ip = switchPos + 1; - continue; - } - - if (!backJumpFound) { - if (jumpPos <= end + 1) { //probably skipping catch - ip = jumpPos; - continue; - } - output.add(new ContinueTreeItem(ins, jumpPos, false)); - ip = ip + 1; - if (!unknownJumps.contains(jumpPos)) { - unknownJumps.add(jumpPos); - } - continue; - //throw new ConvertException("Unknown pattern: forjump with no backjump"); - } - Loop currentLoop = new Loop(jumpPos, adr2pos(afterBackJumpAddr)); - loopList.add(currentLoop); - - if (debugMode) { - System.out.println("expression branch"); - } - ConvertOutput co = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, adr2pos(afterBackJumpAddr) - 2, localRegNames, fullyQualifiedNames, visited); - Stack substack = co.stack; - backJumpIns.definition.translate(isStatic, classIndex, localRegs, substack, scopeStack, constants, backJumpIns, method_info, output, body, abc, localRegNames, fullyQualifiedNames); - - TreeItem expression = substack.pop(); - List subins = new ArrayList(); - boolean isFor = false; - List finalExpression = new ArrayList(); - try { - if (debugMode) { - System.out.println("subins branch"); - } - subins = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, adr2pos(secondAddr) + 1/*label*/, jumpPos - 1, localRegNames, fullyQualifiedNames, visited).output; - } catch (UnknownJumpException uje) { - if ((uje.ip >= start) && (uje.ip <= end)) { - currentLoop.loopContinue = uje.ip; - subins = uje.output; - - List contList = new ArrayList(); - for (TreeItem ti : subins) { - if (ti instanceof ContinueTreeItem) { - contList.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - contList.addAll(((Block) ti).getContinues()); - } - } - for (int u = 0; u < contList.size(); u++) { - if (contList.get(u) instanceof ContinueTreeItem) { - if (((ContinueTreeItem) contList.get(u)).loopPos == uje.ip) { - if (!((ContinueTreeItem) contList.get(u)).isKnown) { - ((ContinueTreeItem) contList.get(u)).isKnown = true; - ((ContinueTreeItem) contList.get(u)).loopPos = currentLoop.loopBreak; - } - } - } - } - if (debugMode) { - System.out.println("final expression branch"); - } - finalExpression = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, uje.ip, jumpPos - 1, localRegNames, fullyQualifiedNames, visited).output; - isFor = true; - } else { - throw new ConvertException("Unknown pattern: jump to nowhere", ip); - } - } - boolean isDoWhile = false; - - if (jumpPos == ip + 2) { - if (code.get(ip + 1).definition instanceof LabelIns) { - isDoWhile = true; - } - } - if (!isDoWhile) { - if (!isFor) { - for (Loop l : loopList) { - if (l.loopContinue == jumpPos) { - if (l.continueCount == 0) { - //isFor = true; - //finalExpression = subins.remove(subins.size() - 1).toString(); - } - break; - } - } - } - } - - String firstIns = ""; - if (isFor) { - if (output.size() > 0) { - //firstIns = output.remove(output.size() - 1).toString(); - } - } - - List loopBody = new ArrayList(); - loopBody.addAll(co.output); - loopBody.addAll(subins); - - if (isFor) { - output.add(new ForTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, new ArrayList(), expression, finalExpression, loopBody)); - } else if (isDoWhile) { - output.add(new DoWhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, loopBody, expression)); - } else { - if (expression instanceof InTreeItem) { - TreeItem gti = ((InTreeItem) expression).collection.getNotCoerced().getThroughRegister(); - if (gti instanceof FilteredCheckTreeItem) { - boolean found = false; - if (loopBody.size() == 1) { - TreeItem ft = loopBody.get(0); - if (ft instanceof WithTreeItem) { - if (((WithTreeItem) ft).items.size() == 1) { - ft = ((WithTreeItem) ft).items.get(0); - if (ft instanceof IfTreeItem) { - IfTreeItem ift = (IfTreeItem) ft; - if (ift.onTrue.size() > 0) { - ft = ift.onTrue.get(0); - if (ft instanceof SetPropertyTreeItem) { - SetPropertyTreeItem spt = (SetPropertyTreeItem) ft; - if (spt.object instanceof LocalRegTreeItem) { - int regIndex = ((LocalRegTreeItem) spt.object).regIndex; - InTreeItem iti = (InTreeItem) expression; - localRegs.put(regIndex, new FilterTreeItem(ins, iti.collection.getThroughRegister(), ift.expression)); - found = true; - addr = afterBackJumpAddr; - ip = adr2pos(addr); - continue iploop; - } - } - } - } - } - } - } - if (!found) { - throw new ConvertException("Unknown pattern: bad filter loop", ip); - } - } - { - boolean found = false; - for (int g = ip + 1; g < jumpPos; g++) { - if (code.get(g).definition instanceof NextValueIns) { - output.add(new ForEachInTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, (InTreeItem) expression, loopBody)); - found = true; - break; - } - if (code.get(g).definition instanceof NextNameIns) { - output.add(new ForInTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, (InTreeItem) expression, loopBody)); - found = true; - break; - } - } - if (!found) { - throw new ConvertException("Unknown pattern: hasnext without nextvalue/nextname", ip); - } - } - - - } else { - output.add(new WhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, expression, loopBody)); - } - } - addr = afterBackJumpAddr; - ip = adr2pos(addr); - } else { - throw new ConvertException("Unknown pattern: back jump ", ip); - } - } else if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { //set_local_x,get_local_x..kill x + if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { //set_local_x,get_local_x..kill x AVM2Instruction insAfter = code.get(ip + 1); if ((insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) { - TreeItem before = stack.peek(); + GraphTargetItem before = stack.peek(); ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames); stack.push(before); ip += 2; @@ -1647,91 +1299,7 @@ public class AVM2Code implements Serializable { break; //throw new ConvertException("Unknown pattern after DUP:" + insComparsion.toString()); } - if (processJumps) { - addr = addr + ins.getBytes().length + insAfter.getBytes().length + insAfter.operands[0]; - nextPos = adr2pos(addr) - 1; - if (isAnd) { - stack.add(new AndTreeItem(insAfter, stack.pop(), toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos, localRegNames, fullyQualifiedNames, visited).stack.pop())); - } else { - stack.add(new OrTreeItem(insAfter, stack.pop(), toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos, localRegNames, fullyQualifiedNames, visited).stack.pop())); - } - ins = code.get(nextPos + 1); - ip = nextPos + 1; - } } while (ins.definition instanceof DupIns); - } else if (ins.definition instanceof IfTypeIns) { - int targetAddr = pos2adr(ip) + ins.getBytes().length + ins.operands[0]; - int targetIns = adr2pos(targetAddr); - ((IfTypeIns) ins.definition).translateInverted(localRegs, stack, ins); - - TreeItem condition = stack.pop(); - - if (condition.isFalse()) { - //ins.definition = new JumpIns(); - //continue; - } - if (condition.isTrue()) { - //ip = targetIns; - //continue; - } - //stack.add("if"+stack.pop()); - //stack.add("{"); - boolean hasElse = false; - boolean hasReturn = false; - if (code.get(targetIns - 1).definition instanceof JumpIns) { - - if ((targetIns - 2 > ip) && ((code.get(targetIns - 2).definition instanceof ReturnValueIns) || (code.get(targetIns - 2).definition instanceof ReturnVoidIns) || (code.get(targetIns - 2).definition instanceof ThrowIns))) { - hasElse = false; - hasReturn = true; - } else { - int jumpAddr = targetAddr + code.get(targetIns - 1).operands[0]; - int jumpPos = adr2pos(jumpAddr); - hasElse = true; - - for (Loop l : loopList) { - if (l.loopBreak == jumpPos) { - hasElse = false; - break; - } - if (l.loopContinue == jumpPos) { - hasElse = false; - break; - } - } - - if (jumpPos > ip && jumpPos < targetIns - 1) { - hasElse = false; - } - - if (hasElse) { - if (adr2pos(jumpAddr) > end + 1) { - hasElse = false; - //throw new ConvertException("Unknown pattern: forward jump outside of the block"); - } - } - } - } - if (debugMode) { - System.out.println("true branch"); - } - ConvertOutput onTrue = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 1, targetIns - 1 - ((hasElse || hasReturn) ? 1 : 0), localRegNames, fullyQualifiedNames, visited); - ip = targetIns; - ConvertOutput onFalse = new ConvertOutput(new Stack(), new ArrayList()); - if (hasElse) { - int finalAddr = targetAddr + code.get(targetIns - 1).operands[0]; - int finalIns = adr2pos(finalAddr); - if (debugMode) { - System.out.println("false branch"); - } - onFalse = toSourceOutput(processJumps, isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, targetIns, finalIns - 1, localRegNames, fullyQualifiedNames, visited); - ip = finalIns; - } - if ((onTrue.stack.size() > 0) && (onFalse != null) && (onFalse.stack.size() > 0)) { - stack.add(new TernarOpTreeItem(ins, condition, onTrue.stack.pop(), onFalse.stack.pop())); - } else { - output.add(new IfTreeItem(ins, condition, onTrue.output, onFalse.output)); - } - } else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) { ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames); ip = end + 1; @@ -1801,7 +1369,7 @@ public class AVM2Code implements Serializable { return ret; } - public String toSource(String path, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { + public String toSource(String path, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { return toSource(path, isStatic, classIndex, abc, constants, method_info, body, false, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits); } @@ -1875,11 +1443,11 @@ public class AVM2Code implements Serializable { ignoredIns = new ArrayList(); } - public String toSource(String path, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { + public String toSource(String path, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { initToSource(); - List list; + List list; String s; - HashMap localRegs = new HashMap(); + HashMap localRegs = new HashMap(); int regCount = getRegisterCount(); int paramCount; @@ -1894,7 +1462,7 @@ public class AVM2Code implements Serializable { //try { try { - list = AVM2Graph.translateViaGraph(path, this, abc, body); + list = AVM2Graph.translateViaGraph(path, this, abc, body, isStatic, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames); } catch (Exception ex2) { Logger.getLogger(AVM2Code.class.getName()).log(Level.SEVERE, "Decompilation error in " + path, ex2); return "/*\r\n * Decompilation error\r\n * Code may be obfuscated\r\n * Error Message: " + ex2.getMessage() + "\r\n */"; @@ -1906,7 +1474,7 @@ public class AVM2Code implements Serializable { }*/ if (initTraits != null) { for (int i = 0; i < list.size(); i++) { - TreeItem ti = list.get(i); + GraphTargetItem ti = list.get(i); if ((ti instanceof InitPropertyTreeItem) || (ti instanceof SetPropertyTreeItem)) { int multinameIndex = 0; TreeItem value = null; @@ -1937,8 +1505,8 @@ public class AVM2Code implements Serializable { } } if (isStaticInitializer) { - List newList = new ArrayList(); - for (TreeItem ti : list) { + List newList = new ArrayList(); + for (GraphTargetItem ti : list) { if (!(ti instanceof ReturnVoidTreeItem)) { if (!(ti instanceof InitPropertyTreeItem)) { if (!(ti instanceof SetPropertyTreeItem)) { @@ -1959,7 +1527,7 @@ public class AVM2Code implements Serializable { } List declaredSlots = new ArrayList(); for (int i = 0; i < list.size(); i++) { - TreeItem ti = list.get(i); + GraphTargetItem ti = list.get(i); if (ti instanceof SetLocalTreeItem) { int reg = ((SetLocalTreeItem) ti).regIndex; if (!declaredRegisters[reg]) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConvertOutput.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConvertOutput.java index 1935adc01..b3016cf49 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConvertOutput.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/ConvertOutput.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.avm2; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -26,10 +26,10 @@ import java.util.Stack; */ public class ConvertOutput { - public Stack stack; - public List output; + public Stack stack; + public List output; - public ConvertOutput(Stack stack, List output) { + public ConvertOutput(Stack stack, List output) { this.stack = stack; this.output = output; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/UnknownJumpException.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/UnknownJumpException.java index 4aafc2d94..38990002f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/UnknownJumpException.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/UnknownJumpException.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.avm2; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -24,9 +24,9 @@ public class UnknownJumpException extends RuntimeException { public Stack stack; public int ip; - public List output; + public List output; - public UnknownJumpException(Stack stack, int ip, List output) { + public UnknownJumpException(Stack stack, int ip, List output) { this.stack = stack; this.ip = ip; this.output = output; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index da1cef3d7..7fb08a16a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -18,70 +18,15 @@ package com.jpexs.decompiler.flash.abc.avm2.graph; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; -import com.jpexs.decompiler.flash.abc.avm2.ConvertException; -import com.jpexs.decompiler.flash.abc.avm2.ConvertOutput; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfFalseIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictEqIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfTrueIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.LookupSwitchIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.GetLocalTypeIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.KillIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.LabelIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnValueIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnVoidIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ThrowIns; -import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.*; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.BreakTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.CommentTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.FilteredCheckTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.HasNextTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.InTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.NextNameTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.NextValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.NullTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ReturnValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ReturnVoidTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetPropertyTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetTypeTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.WithTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.DoWhileTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ExceptionTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.FilterTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ForEachInTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ForInTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ForTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.IfTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.SwitchTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.TernarOpTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.TryTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.WhileTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AndTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LogicalOp; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.OrTreeItem; -import com.jpexs.decompiler.flash.abc.types.ABCException; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.graph.Graph; import com.jpexs.decompiler.flash.graph.GraphPart; -import com.jpexs.decompiler.flash.graph.GraphPartMulti; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.graph.Loop; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Stack; -import java.util.logging.Level; -import java.util.logging.Logger; /** * @@ -93,1043 +38,1055 @@ public class AVM2Graph extends Graph { private ABC abc; private MethodBody body; - public AVM2Graph(AVM2Code code, ABC abc, MethodBody body) { - heads = makeGraph(code, new ArrayList(), body); - this.code = code; - this.abc = abc; - this.body = body; - for (GraphPart head : heads) { - fixGraph(head); - makeMulti(head, new ArrayList()); - } + public AVM2Graph(AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames) { + super(new AVM2GraphSource(code, isStatic, classIndex, localRegs, scopeStack, abc, body, localRegNames, fullyQualifiedNames), body.getExceptionEntries()); + /*heads = makeGraph(code, new ArrayList(), body); + this.code = code; + this.abc = abc; + this.body = body; + for (GraphPart head : heads) { + fixGraph(head); + makeMulti(head, new ArrayList()); + }*/ } - public GraphPart getNextNoJump(GraphPart part) { - while (code.code.get(part.start).definition instanceof JumpIns) { - part = part.getSubParts().get(0).nextParts.get(0); - } - return part; - } - - public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body) { - AVM2Graph g = new AVM2Graph(code, abc, body); + public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames) { + AVM2Graph g = new AVM2Graph(code, abc, body, isStatic, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames); List allParts = new ArrayList(); for (GraphPart head : g.heads) { populateParts(head, allParts); } - return g.printGraph(path, new Stack(), new Stack(), allParts, new ArrayList(), new ArrayList(), 0, null, g.heads.get(0), null, new ArrayList(), new HashMap(), body, new ArrayList()); - } - - private List getLoopsContinues(List loops) { - List ret = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - ret.add(l.loopContinue); - } - } - return ret; - } - - private TreeItem checkLoop(GraphPart part, GraphPart stopPart, List loops) { - if (part == stopPart) { - return null; - } - for (Loop l : loops) { - if (l.loopContinue == part) { - return (new ContinueTreeItem(null, l.id)); - } - if (l.loopBreak == part) { - return (new BreakTreeItem(null, l.id)); - } - } - return null; - } - private boolean doDecompile = true; - - private void checkContinueAtTheEnd(List commands, Loop loop) { - if (!commands.isEmpty()) { - if (commands.get(commands.size() - 1) instanceof ContinueTreeItem) { - if (((ContinueTreeItem) commands.get(commands.size() - 1)).loopPos == loop.id) { - commands.remove(commands.size() - 1); - } - } - } - } - - private List printGraph(String methodPath, Stack stack, Stack scopeStack, List allParts, List parsedExceptions, List finallyJumps, int level, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap localRegs, MethodBody body, List ignoredSwitches) { - List ret = new ArrayList(); - boolean debugMode = false; - - try { - if (!doDecompile) { - ret.add(new CommentTreeItem(null, "not decompiled")); - return ret; - } - - if (debugMode) { - System.err.println("PART " + part); - } - - if (part == stopPart) { - return ret; - } - if (part.ignored) { - return ret; - } - List fqn = new ArrayList(); - HashMap lrn = new HashMap(); - List output = new ArrayList(); - boolean isSwitch = false; - try { - code.initToSource(); - List parts = new ArrayList(); - if (part instanceof GraphPartMulti) { - parts = ((GraphPartMulti) part).parts; - } else { - parts.add(part); - } - boolean isIf = false; - int end = part.end; - for (GraphPart p : parts) { - end = p.end; - int start = p.start; - isIf = false; - if (code.code.get(end).definition instanceof JumpIns) { - end--; - } else if (code.code.get(end).definition instanceof IfTypeIns) { - end--; - isIf = true; - } else if (code.code.get(end).definition instanceof LookupSwitchIns) { - isSwitch = true; - end--; - } - ConvertOutput co = code.toSourceOutput(false, false, 0, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, start, end, lrn, fqn, new boolean[code.code.size()]); - output.addAll(co.output); - - } - if (isIf) { - AVM2Instruction ins = code.code.get(end + 1); - if ((stack.size() >= 2) && (ins.definition instanceof IfFalseIns) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { - ret.addAll(output); - - GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); - GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); - boolean reversed = false; - List loopContinues = getLoopsContinues(loops); - loopContinues.add(part); - if (sp1.leadsTo(sp0, loopContinues)) { - } else if (sp0.leadsTo(sp1, loopContinues)) { - reversed = true; - } - GraphPart next = reversed ? sp0 : sp1; - TreeItem ti; - if ((ti = checkLoop(next, stopPart, loops)) != null) { - ret.add(ti); - } else { - printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, reversed ? sp1 : sp0, loops, localRegs, body, ignoredSwitches); - TreeItem second = stack.pop(); - TreeItem first = stack.pop(); - if (!reversed) { - AndTreeItem a = new AndTreeItem(ins, first, second); - stack.push(a); - a.firstPart = part; - if (second instanceof AndTreeItem) { - a.firstPart = ((AndTreeItem) second).firstPart; - } - if (second instanceof OrTreeItem) { - a.firstPart = ((AndTreeItem) second).firstPart; - } - } else { - OrTreeItem o = new OrTreeItem(ins, first, second); - stack.push(o); - o.firstPart = part; - if (second instanceof OrTreeItem) { - o.firstPart = ((OrTreeItem) second).firstPart; - } - if (second instanceof OrTreeItem) { - o.firstPart = ((OrTreeItem) second).firstPart; - } - } - next = reversed ? sp1 : sp0; - if ((ti = checkLoop(next, stopPart, loops)) != null) { - ret.add(ti); - } else { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, stopPart, loops, localRegs, body, ignoredSwitches)); - } - } - return ret; - } else if ((stack.size() >= 2) && (ins.definition instanceof IfTrueIns) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { - ret.addAll(output); - GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); - GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); - boolean reversed = false; - List loopContinues = getLoopsContinues(loops); - loopContinues.add(part); - if (sp1.leadsTo(sp0, loopContinues)) { - } else if (sp0.leadsTo(sp1, loopContinues)) { - reversed = true; - } - GraphPart next = reversed ? sp0 : sp1; - TreeItem ti; - if ((ti = checkLoop(next, stopPart, loops)) != null) { - ret.add(ti); - } else { - printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, reversed ? sp1 : sp0, loops, localRegs, body, ignoredSwitches); - TreeItem second = stack.pop(); - TreeItem first = stack.pop(); - if (reversed) { - AndTreeItem a = new AndTreeItem(ins, first, second); - stack.push(a); - a.firstPart = part; - if (second instanceof AndTreeItem) { - a.firstPart = ((AndTreeItem) second).firstPart; - } - if (second instanceof OrTreeItem) { - a.firstPart = ((AndTreeItem) second).firstPart; - } - } else { - OrTreeItem o = new OrTreeItem(ins, first, second); - stack.push(o); - o.firstPart = part; - if (second instanceof OrTreeItem) { - o.firstPart = ((OrTreeItem) second).firstPart; - } - if (second instanceof OrTreeItem) { - o.firstPart = ((OrTreeItem) second).firstPart; - } - } - - next = reversed ? sp1 : sp0; - if ((ti = checkLoop(next, stopPart, loops)) != null) { - ret.add(ti); - } else { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, stopPart, loops, localRegs, body, ignoredSwitches)); - } - } - - return ret; - } else if ((((ins.definition instanceof IfStrictNeIns)) && ((part.nextParts.get(1).getHeight() == 2) && (code.code.get(part.nextParts.get(1).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) - || (((ins.definition instanceof IfStrictEqIns)) && ((part.nextParts.get(0).getHeight() == 2) && (code.code.get(part.nextParts.get(0).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)))) { - ret.addAll(output); - boolean reversed = false; - if (ins.definition instanceof IfStrictEqIns) { - reversed = true; - } - TreeItem switchedObject = null; - if (!output.isEmpty()) { - if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { - switchedObject = ((SetLocalTreeItem) output.get(output.size() - 1)).value; - } - } - if (switchedObject == null) { - switchedObject = new NullTreeItem(null); - } - HashMap caseValuesMap = new HashMap(); - - stack.pop(); - caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); - - GraphPart switchLoc = part.nextParts.get(reversed ? 0 : 1).nextParts.get(0); - - - while ((code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) - || (code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) { - part = part.nextParts.get(reversed ? 1 : 0); - List ps = part.getSubParts(); - for (GraphPart p : ps) { - code.toSourceOutput(false, false, 0, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, p.start, p.end - 1, lrn, fqn, new boolean[code.code.size()]); - } - stack.pop(); - if (code.code.get(part.end).definition instanceof IfStrictNeIns) { - reversed = false; - } else { - reversed = true; - } - caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); - - } - boolean hasDefault = false; - GraphPart dp = part.nextParts.get(reversed ? 1 : 0); - while (code.code.get(dp.start).definition instanceof JumpIns) { - if (dp instanceof GraphPartMulti) { - dp = ((GraphPartMulti) dp).parts.get(0); - } - dp = dp.nextParts.get(0); - } - if (code.code.get(dp.start).definition instanceof PushByteIns) { - hasDefault = true; - } - List caseValues = new ArrayList(); - for (int i = 0; i < switchLoc.nextParts.size() - 1; i++) { - if (caseValuesMap.containsKey(i)) { - caseValues.add(caseValuesMap.get(i)); - } else { - continue; - } - } - - List> caseCommands = new ArrayList>(); - GraphPart next = null; - - List loopContinues = getLoopsContinues(loops); - - next = switchLoc.getNextPartPath(loopContinues); - if (next == null) { - next = switchLoc.getNextSuperPartPath(loopContinues); - } - /*for (GraphPart p : allParts) { - if (p.start == switchLoc.end + 1) { - next = p; - break; - } - }*/ - - TreeItem ti = checkLoop(next, stopPart, loops); - Loop currentLoop = new Loop(null, next); - loops.add(currentLoop); - //switchLoc.getNextPartPath(new ArrayList()); - List valuesMapping = new ArrayList(); - List caseBodies = new ArrayList(); - for (int i = 0; i < caseValues.size(); i++) { - GraphPart cur = switchLoc.nextParts.get(1 + i); - if (!caseBodies.contains(cur)) { - caseBodies.add(cur); - } - valuesMapping.add(caseBodies.indexOf(cur)); - } - - List defaultCommands = new ArrayList(); - GraphPart defaultPart = null; - if (hasDefault) { - defaultPart = switchLoc.nextParts.get(switchLoc.nextParts.size() - 1); - defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, defaultPart, next, loops, localRegs, body, ignoredSwitches); - } - - List ignored = new ArrayList(); - for (Loop l : loops) { - ignored.add(l.loopContinue); - } - - for (int i = 0; i < caseBodies.size(); i++) { - List cc = new ArrayList(); - GraphPart nextCase = null; - nextCase = next; - if (next != null) { - if (i < caseBodies.size() - 1) { - if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { - cc.add(new BreakTreeItem(null, next.start)); - } else { - nextCase = caseBodies.get(i + 1); - } - } else if (hasDefault) { - if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { - cc.add(new BreakTreeItem(null, next.start)); - } else { - nextCase = defaultPart; - } - } - } - cc.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, caseBodies.get(i), nextCase, loops, localRegs, body, ignoredSwitches)); - caseCommands.add(cc); - } - - SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); - ret.add(sti); - loops.remove(currentLoop); - if (next != null) { - if (ti != null) { - ret.add(ti); - } else { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, next, stopPart, loops, localRegs, body, ignoredSwitches)); - } - } - return ret; - } else { - try { - ins.definition.translate(false, 0, new HashMap(), stack, new Stack(), abc.constants, ins, abc.method_info, output, body, abc, lrn, fqn); - } catch (Exception ex) { - System.err.println("ip:" + (end + 1)); - ex.printStackTrace(); - } - } - //((IfTypeIns)ins.definition).translateInverted(new HashMap(), co.stack, ins); - } - } catch (ConvertException ex) { - Logger.getLogger(AVM2Graph.class.getName()).log(Level.SEVERE, null, ex); - } - - int ip = part.start; - int addr = code.fixAddrAfterDebugLine(code.pos2adr(part.start)); - int maxend = -1; - List catchedExceptions = new ArrayList(); - for (int e = 0; e < body.exceptions.length; e++) { - if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { - if (!body.exceptions[e].isFinally()) { - if (((body.exceptions[e].end) > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) { - catchedExceptions.clear(); - maxend = code.fixAddrAfterDebugLine(body.exceptions[e].end); - catchedExceptions.add(body.exceptions[e]); - } else if (code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) { - catchedExceptions.add(body.exceptions[e]); - } - } - } - } - if (catchedExceptions.size() > 0) { - parsedExceptions.addAll(catchedExceptions); - int endpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end)); - int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); - - - List> catchedCommands = new ArrayList>(); - if (code.code.get(endpos).definition instanceof JumpIns) { - int afterCatchAddr = code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0]; - int afterCatchPos = code.adr2pos(afterCatchAddr); - Collections.sort(catchedExceptions, new Comparator() { - public int compare(ABCException o1, ABCException o2) { - try { - return code.fixAddrAfterDebugLine(o1.target) - code.fixAddrAfterDebugLine(o2.target); - } catch (ConvertException ex) { - return 0; - } - } - }); - - - List finallyCommands = new ArrayList(); - int returnPos = afterCatchPos; - for (int e = 0; e < body.exceptions.length; e++) { - if (body.exceptions[e].isFinally()) { - if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { - if (afterCatchPos + 1 == code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))) { - AVM2Instruction jmpIns = code.code.get(code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))); - if (jmpIns.definition instanceof JumpIns) { - int finStart = code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]); - finallyJumps.add(finStart); - /*if (unknownJumps.contains(finStart)) { - unknownJumps.remove((Integer) finStart); - }*/ - for (int f = finStart; f < code.code.size(); f++) { - if (code.code.get(f).definition instanceof LookupSwitchIns) { - AVM2Instruction swins = code.code.get(f); - if (swins.operands.length >= 3) { - if (swins.operands[0] == swins.getBytes().length) { - if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) { - GraphPart fpart = null; - for (GraphPart p : allParts) { - if (p.start == finStart) { - fpart = p; - break; - } - } - stack.push(new ExceptionTreeItem(body.exceptions[e])); - GraphPart fepart = null; - for (GraphPart p : allParts) { - if (p.start == f + 1) { - fepart = p; - break; - } - } - //code.code.get(f).ignored = true; - ignoredSwitches.add(f); - finallyCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, fpart, fepart, loops, localRegs, body, ignoredSwitches); - returnPos = f + 1; - break; - } - } - } - } - } - - break; - } - } - } - } - } - - for (int e = 0; e < catchedExceptions.size(); e++) { - int eendpos; - if (e < catchedExceptions.size() - 1) { - eendpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2; - } else { - eendpos = afterCatchPos - 1; - } - Stack substack = new Stack(); - substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); - - GraphPart npart = null; - int findpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e).target)); - for (GraphPart p : allParts) { - if (p.start == findpos) { - npart = p; - break; - } - } - - GraphPart nepart = null; - for (GraphPart p : allParts) { - if (p.start == eendpos + 1) { - nepart = p; - break; - } - } - stack.add(new ExceptionTreeItem(catchedExceptions.get(e))); - catchedCommands.add(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, npart, nepart, loops, localRegs, body, ignoredSwitches)); - } - - GraphPart nepart = null; - - for (GraphPart p : allParts) { - if (p.start == endposStartBlock) { - nepart = p; - break; - } - } - List tryCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, part, nepart, loops, localRegs, body, ignoredSwitches); - - output.clear(); - output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); - ip = returnPos; - addr = code.pos2adr(ip); - } - - } - - if (ip != part.start) { - part = null; - for (GraphPart p : allParts) { - List ps = p.getSubParts(); - for (GraphPart p2 : ps) { - if (p2.start == ip) { - part = p2; - break; - } - } - } - ret.addAll(output); - TreeItem lop = checkLoop(part, stopPart, loops); - if (lop == null) { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, part, stopPart, loops, localRegs, body, ignoredSwitches)); - } else { - ret.add(lop); - } - return ret; - } - - List loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } - boolean loop = false; - boolean reversed = false; - boolean whileTrue = false; - Loop whileTrueLoop = null; - if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { - if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { - if (output.isEmpty()) { - whileTrueLoop = new Loop(part, null); - loops.add(whileTrueLoop); - whileTrue = true; - } else { - loop = true;//doWhile - } - - } else { - loop = true; - } - } else if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { - loop = true; - reversed = true; - } - if (((part.nextParts.size() == 2) || ((part.nextParts.size() == 1) && loop)) && (!isSwitch)) { - - boolean doWhile = loop; - if (loop && output.isEmpty()) { - doWhile = false; - } - Loop currentLoop = new Loop(part, null); - if (loop) { - loops.add(currentLoop); - } - - loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } - - if ((part.nextParts.size() > 1) && (!doWhile)) { - currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); - } - - TreeItem expr = null; - if ((code.code.get(part.end).definition instanceof JumpIns) || (!(code.code.get(part.end).definition instanceof IfTypeIns))) { - expr = new BooleanTreeItem(null, true); - } else { - if (!stack.isEmpty()) { - expr = stack.pop(); - } - } - if (loop) { - if (expr instanceof AndTreeItem) { - currentLoop.loopContinue = ((AndTreeItem) expr).firstPart; - } - if (expr instanceof OrTreeItem) { - currentLoop.loopContinue = ((OrTreeItem) expr).firstPart; - } - } - - if (doWhile) { - //ret.add(new DoWhileTreeItem(null, currentLoop.id, part.start, output, expr)); - } else { - ret.addAll(output); - } - GraphPart loopBodyStart = null; - GraphPart next = part.getNextPartPath(loopContinues); - if (reversed && (expr instanceof LogicalOp)) { - expr = ((LogicalOp) expr).invert(); - } - List retx = ret; - if ((!loop) || (doWhile && (part.nextParts.size() > 1))) { - if (doWhile) { - retx = output; - - } - int stackSizeBefore = stack.size(); - Stack trueStack = (Stack) stack.clone(); - Stack falseStack = (Stack) stack.clone(); - TreeItem lopTrue = checkLoop(part.nextParts.get(1), stopPart, loops); - TreeItem lopFalse = null; - if (next != part.nextParts.get(0)) { - lopFalse = checkLoop(part.nextParts.get(0), stopPart, loops); - } - List onTrue = new ArrayList(); - if (lopTrue != null) { - onTrue.add(lopTrue); - } else { - if (debugMode) { - System.err.println("ONTRUE: (inside " + part + ")"); - } - onTrue = printGraph(methodPath, trueStack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(1), next == null ? stopPart : next, loops, localRegs, body, ignoredSwitches); - if (debugMode) { - System.err.println("/ONTRUE (inside " + part + ")"); - } - } - List onFalse = new ArrayList(); - if (lopFalse != null) { - onFalse.add(lopFalse); - } else { - if (debugMode) { - System.err.println("ONFALSE: (inside " + part + ")"); - } - onFalse = (((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) ? new ArrayList() : printGraph(methodPath, falseStack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(0), next == null ? stopPart : next, loops, localRegs, body, ignoredSwitches)); - if (debugMode) { - System.err.println("/ONFALSE (inside " + part + ")"); - } - } - - if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { - stack.push(new TernarOpTreeItem(null, expr, trueStack.pop(), falseStack.pop())); - } else { - List retw = retx; - if (whileTrue) { - retw = new ArrayList(); - retw.add(new IfTreeItem(null, expr, onTrue, onFalse)); - retx.add(new WhileTreeItem(null, whileTrueLoop.id, whileTrueLoop.loopContinue.start, new BooleanTreeItem(null, true), retw)); - } else { - retx.add(new IfTreeItem(null, expr, onTrue, onFalse)); - } - - //Same continues in onTrue and onFalse gets continue on parent level - if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { - if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { - if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { - if (((ContinueTreeItem) onTrue.get(onTrue.size() - 1)).loopPos == ((ContinueTreeItem) onFalse.get(onFalse.size() - 1)).loopPos) { - onTrue.remove(onTrue.size() - 1); - retw.add(onFalse.remove(onFalse.size() - 1)); - } - } - } - } - - if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { - if (onTrue.get(onTrue.size() - 1) instanceof ReturnValueTreeItem || onTrue.get(onTrue.size() - 1) instanceof ReturnVoidTreeItem) { - if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { - retw.add(onFalse.remove(onFalse.size() - 1)); - } - } - } - - if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { - if (onFalse.get(onFalse.size() - 1) instanceof ReturnValueTreeItem || onFalse.get(onFalse.size() - 1) instanceof ReturnVoidTreeItem) { - if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { - retw.add(onTrue.remove(onTrue.size() - 1)); - } - } - } - if (whileTrue) { - checkContinueAtTheEnd(retw, whileTrueLoop); - } - } - if (doWhile) { - loopBodyStart = next; - } - } - if (loop) { // && (!doWhile)) { - List loopBody = null; - List finalCommands = null; - GraphPart finalPart = null; - boolean isFor = false; - try { - loopBody = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, loopBodyStart != null ? loopBodyStart : part.nextParts.get(reversed ? 1 : 0), stopPart, loops, localRegs, body, ignoredSwitches); - checkContinueAtTheEnd(loopBody, currentLoop); - } catch (ForException fex) { - loopBody = fex.output; - finalCommands = fex.finalOutput; - if (!finalCommands.isEmpty()) { - finalCommands.remove(finalCommands.size() - 1); //remove continue - } - finalPart = fex.continuePart; - isFor = true; - for (Object o : finalPart.forContinues) { - if (o instanceof ContinueTreeItem) { - ((ContinueTreeItem) o).loopPos = currentLoop.id; - } - } - } - if (isFor) { - ret.add(new ForTreeItem(null, currentLoop.id, finalPart.start, new ArrayList(), expr, finalCommands, loopBody)); - } else if ((expr instanceof HasNextTreeItem) && ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister() instanceof FilteredCheckTreeItem) { - TreeItem gti = ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister(); - boolean found = false; - if ((loopBody.size() == 3) || (loopBody.size() == 4)) { - TreeItem ft = loopBody.get(0); - if (ft instanceof WithTreeItem) { - ft = loopBody.get(1); - if (ft instanceof IfTreeItem) { - IfTreeItem ift = (IfTreeItem) ft; - if (ift.onTrue.size() > 0) { - ft = ift.onTrue.get(0); - if (ft instanceof SetPropertyTreeItem) { - SetPropertyTreeItem spt = (SetPropertyTreeItem) ft; - if (spt.object instanceof LocalRegTreeItem) { - int regIndex = ((LocalRegTreeItem) spt.object).regIndex; - HasNextTreeItem iti = (HasNextTreeItem) expr; - localRegs.put(regIndex, new FilterTreeItem(null, iti.collection.getThroughRegister(), ift.expression)); - } - } - } - } - } - } - } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextValueTreeItem)) { - TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); - loopBody.remove(0); - ret.add(new ForEachInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); - } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextNameTreeItem)) { - TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); - loopBody.remove(0); - ret.add(new ForInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); - } else { - if (doWhile) { - if (stack.isEmpty()) { - expr = new BooleanTreeItem(null, true); - } else { - expr = stack.pop(); - } - loopBody.addAll(0, output); - checkContinueAtTheEnd(loopBody, currentLoop); - - List addIf = new ArrayList(); - if ((!loopBody.isEmpty()) && (loopBody.get(loopBody.size() - 1) instanceof IfTreeItem)) { - IfTreeItem ift = (IfTreeItem) loopBody.get(loopBody.size() - 1); - if (ift.onFalse.isEmpty()) { - expr = ift.expression; - addIf = ift.onTrue; - loopBody.remove(loopBody.size() - 1); - } - } - ret.add(new DoWhileTreeItem(null, currentLoop.id, part.start, loopBody, expr)); - ret.addAll(addIf); - - } else { - ret.add(new WhileTreeItem(null, currentLoop.id, part.start, expr, loopBody)); - } - } - } - if ((!doWhile) && (!whileTrue) && loop && (part.nextParts.size() > 1)) { - loops.remove(currentLoop); //remove loop so no break shows up - //ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level, part, part.nextParts.get(reversed ? 0 : 1), stopPart, loops, localRegs, body, ignoredSwitches)); - next = part.nextParts.get(reversed ? 0 : 1); - } - if (doWhile) { - next = null; - } - if (next != null) { - boolean finallyJump = false; - for (int f : finallyJumps) { - if (next.start == f) { - finallyJump = true; - break; - } - } - if (!finallyJump) { - TreeItem ti = checkLoop(next, stopPart, loops); - if (ti != null) { - ret.add(ti); - } else { - if (debugMode) { - System.err.println("NEXT: (inside " + part + ")"); - } - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level, part, next, stopPart, loops, localRegs, body, ignoredSwitches)); - if (debugMode) { - System.err.println("/NEXT: (inside " + part + ")"); - } - } - } - } - } else { - ret.addAll(output); - } - onepart: - if (part.nextParts.size() == 1 && (!loop)) { - if (part.end - part.start > 4) { - if (code.code.get(part.end).definition instanceof PopIns) { - if (code.code.get(part.end - 1).definition instanceof LabelIns) { - if (code.code.get(part.end - 2).definition instanceof PushByteIns) { - - //if (code.code.get(part.end - 3).definition instanceof SetLocalTypeIns) { - if (part.nextParts.size() == 1) { - GraphPart sec = part.nextParts.get(0); - - if (code.code.get(sec.end).definition instanceof ReturnValueIns) { - if (sec.end - sec.start >= 3) { - if (code.code.get(sec.end - 1).definition instanceof KillIns) { - if (code.code.get(sec.end - 2).definition instanceof GetLocalTypeIns) { - if (!output.isEmpty()) { - if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { - sec.ignored = true; - ret.add(new ReturnValueTreeItem(code.code.get(sec.end), ((SetLocalTreeItem) output.get(output.size() - 1)).value)); - break onepart; - } - } - } - } - } - - } else if (code.code.get(sec.end).definition instanceof ReturnVoidIns) { - ret.add(new ReturnVoidTreeItem(code.code.get(sec.end))); - break onepart; - } - //} - } - } - } - } - } - - for (int f : finallyJumps) { - if (part.nextParts.get(0).start == f) { - if ((!output.isEmpty()) && (output.get(output.size() - 1) instanceof SetLocalTreeItem)) { - ret.add(new ReturnValueTreeItem(null, ((SetLocalTreeItem) output.get(output.size() - 1)).value)); - } else { - ret.add(new ReturnVoidTreeItem(null)); - } - - break onepart; - } - } - - GraphPart p = part.nextParts.get(0); - TreeItem lop = checkLoop(p, stopPart, loops); - if (lop == null) { - if (p.path.length() == part.path.length()) { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, p, stopPart, loops, localRegs, body, ignoredSwitches)); - } else { - if ((p != stopPart) && (p.refs.size() > 1)) { - ContinueTreeItem cti = new ContinueTreeItem(null, -1); - //p.forContinues.add(cti); - ret.add(new CommentTreeItem(null, "Unknown jump to part " + p)); - ret.add(cti); - } - } - } else { - ret.add(lop); - } - //} - //ret += (strOfChars(level, TAB) + "continue;\r\n"); - //} - } - if (isSwitch && (!ignoredSwitches.contains(part.end))) { - //ret.add(new CommentTreeItem(code.code.get(part.end), "Switch not supported")); - TreeItem switchedObject = stack.pop(); - List caseValues = new ArrayList(); - List valueMappings = new ArrayList(); - List> caseCommands = new ArrayList>(); - - GraphPart next = part.getNextPartPath(loopContinues); - int breakPos = -1; - if (next != null) { - breakPos = next.start; - } - List defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(0), stopPart, loops, localRegs, body, ignoredSwitches); - - for (int i = 0; i < part.nextParts.size() - 1; i++) { - caseValues.add(new IntegerValueTreeItem(null, (Long) (long) i)); - valueMappings.add(i); - GraphPart nextCase = next; - List caseBody = new ArrayList(); - if (i < part.nextParts.size() - 1 - 1) { - if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(1 + i + 1), new ArrayList())) { - caseBody.add(new BreakTreeItem(null, breakPos)); - } else { - nextCase = part.nextParts.get(1 + i + 1); - } - } else if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(0), new ArrayList())) { - caseBody.add(new BreakTreeItem(null, breakPos)); - } else { - nextCase = part.nextParts.get(0); - } - caseBody.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(1 + i), nextCase, loops, localRegs, body, ignoredSwitches)); - caseCommands.add(caseBody); - } - - SwitchTreeItem swt = new SwitchTreeItem(null, breakPos, switchedObject, caseValues, caseCommands, defaultCommands, valueMappings); - ret.add(swt); - - if (next != null) { - TreeItem lopNext = checkLoop(next, stopPart, loops); - if (lopNext != null) { - ret.add(lopNext); - } else { - ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, next, stopPart, loops, localRegs, body, ignoredSwitches)); - } - } - - } - - } catch (ForException fex) { - ret.addAll(fex.output); - fex.output = ret; - throw fex; - } - code.clearTemporaryRegisters(ret); - if (!part.forContinues.isEmpty()) { - throw new ForException(new ArrayList(), ret, part); - } - return ret; - } - - private List makeGraph(AVM2Code code, List allBlocks, MethodBody body) { - HashMap> refs = code.visitCode(body); - List ret = new ArrayList(); - boolean visited[] = new boolean[code.code.size()]; - ret.add(makeGraph(null, "0", code, 0, 0, allBlocks, refs, visited)); - for (ABCException ex : body.exceptions) { - GraphPart e1 = new GraphPart(-1, -1); - e1.path = "e"; - GraphPart e2 = new GraphPart(-1, -1); - e2.path = "e"; - GraphPart e3 = new GraphPart(-1, -1); - e3.path = "e"; - makeGraph(e1, "e", code, code.adr2pos(ex.start), code.adr2pos(ex.start), allBlocks, refs, visited); - makeGraph(e2, "e", code, code.adr2pos(ex.end), code.adr2pos(ex.end), allBlocks, refs, visited); - ret.add(makeGraph(e3, "e", code, code.adr2pos(ex.target), code.adr2pos(ex.target), allBlocks, refs, visited)); - } - return ret; - } - - private GraphPart makeGraph(GraphPart parent, String path, AVM2Code code, int startip, int lastIp, List allBlocks, HashMap> refs, boolean visited2[]) { - - int ip = startip; - for (GraphPart p : allBlocks) { - if (p.start == ip) { - p.refs.add(parent); - return p; - } - } - GraphPart g; - GraphPart ret = new GraphPart(ip, -1); - ret.path = path; - GraphPart part = ret; - while (ip < code.code.size()) { - if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) { - part.end = lastIp; - GraphPart found = null; - for (GraphPart p : allBlocks) { - if (p.start == ip) { - found = p; - break; - } - } - - allBlocks.add(part); - - if (found != null) { - part.nextParts.add(found); - found.refs.add(part); - break; - } else { - GraphPart gp = new GraphPart(ip, -1); - gp.path = path; - part.nextParts.add(gp); - gp.refs.add(part); - part = gp; - } - } - lastIp = ip; - AVM2Instruction ins = code.code.get(ip); - if ((ins.definition instanceof ThrowIns) || (ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns)) { - part.end = ip; - allBlocks.add(part); - break; - } - if (ins.definition instanceof LookupSwitchIns) { - part.end = ip; - allBlocks.add(part); - try { - part.nextParts.add(g = makeGraph(part, path + "0", code, code.adr2pos(code.pos2adr(ip) + ins.operands[0]), ip, allBlocks, refs, visited2)); - g.refs.add(part); - for (int i = 2; i < ins.operands.length; i++) { - part.nextParts.add(g = makeGraph(part, path + (i - 1), code, code.adr2pos(code.pos2adr(ip) + ins.operands[i]), ip, allBlocks, refs, visited2)); - g.refs.add(part); - } - break; - } catch (ConvertException ex) { - } - } - if (ins.definition instanceof JumpIns) { - try { - part.end = ip; - allBlocks.add(part); - ip = code.adr2pos(code.pos2adr(ip) + ins.getBytes().length + ins.operands[0]); - part.nextParts.add(g = makeGraph(part, path, code, ip, lastIp, allBlocks, refs, visited2)); - g.refs.add(part); - break; - } catch (ConvertException ex) { - Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex); - } - } else if (ins.definition instanceof IfTypeIns) { - part.end = ip; - allBlocks.add(part); - try { - part.nextParts.add(g = makeGraph(part, path + "0", code, code.adr2pos(code.pos2adr(ip) + ins.getBytes().length + ins.operands[0]), ip, allBlocks, refs, visited2)); - g.refs.add(part); - part.nextParts.add(g = makeGraph(part, path + "1", code, ip + 1, ip, allBlocks, refs, visited2)); - g.refs.add(part); - - } catch (ConvertException ex) { - Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex); - } - break; - } - ip++; - }; - return ret; + List localData = new ArrayList(); + localData.add((Boolean) isStatic); + localData.add((Integer) classIndex); + localData.add(localRegs); + localData.add(scopeStack); + localData.add(abc.constants); + localData.add(abc.method_info); + localData.add(body); + localData.add(abc); + localData.add(localRegNames); + localData.add(fullyQualifiedNames); + return g.printGraph(localData, new Stack(), allParts, null, g.heads.get(0), null, new ArrayList(), new HashMap>()); } + /* + public GraphPart getNextNoJump(GraphPart part) { + while (code.code.get(part.start).definition instanceof JumpIns) { + part = part.getSubParts().get(0).nextParts.get(0); + } + return part; + } + + public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body) { + AVM2Graph g = new AVM2Graph(code, abc, body); + List allParts = new ArrayList(); + for (GraphPart head : g.heads) { + populateParts(head, allParts); + } + return g.printGraph(path, new Stack(), new Stack(), allParts, new ArrayList(), new ArrayList(), 0, null, g.heads.get(0), null, new ArrayList(), new HashMap(), body, new ArrayList()); + } + + private List getLoopsContinues(List loops) { + List ret = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + ret.add(l.loopContinue); + } + } + return ret; + } + + private TreeItem checkLoop(GraphPart part, GraphPart stopPart, List loops) { + if (part == stopPart) { + return null; + } + for (Loop l : loops) { + if (l.loopContinue == part) { + return (new ContinueTreeItem(null, l.id)); + } + if (l.loopBreak == part) { + return (new BreakTreeItem(null, l.id)); + } + } + return null; + } + private boolean doDecompile = true; + + private void checkContinueAtTheEnd(List commands, Loop loop) { + if (!commands.isEmpty()) { + if (commands.get(commands.size() - 1) instanceof ContinueTreeItem) { + if (((ContinueTreeItem) commands.get(commands.size() - 1)).loopPos == loop.id) { + commands.remove(commands.size() - 1); + } + } + } + } + + private List printGraph(String methodPath, Stack stack, Stack scopeStack, List allParts, List parsedExceptions, List finallyJumps, int level, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap localRegs, MethodBody body, List ignoredSwitches) { + List ret = new ArrayList(); + boolean debugMode = false; + + try { + if (!doDecompile) { + ret.add(new CommentTreeItem(null, "not decompiled")); + return ret; + } + + if (debugMode) { + System.err.println("PART " + part); + } + + if (part == stopPart) { + return ret; + } + if (part.ignored) { + return ret; + } + List fqn = new ArrayList(); + HashMap lrn = new HashMap(); + List output = new ArrayList(); + boolean isSwitch = false; + try { + code.initToSource(); + List parts = new ArrayList(); + if (part instanceof GraphPartMulti) { + parts = ((GraphPartMulti) part).parts; + } else { + parts.add(part); + } + boolean isIf = false; + int end = part.end; + for (GraphPart p : parts) { + end = p.end; + int start = p.start; + isIf = false; + if (code.code.get(end).definition instanceof JumpIns) { + end--; + } else if (code.code.get(end).definition instanceof IfTypeIns) { + end--; + isIf = true; + } else if (code.code.get(end).definition instanceof LookupSwitchIns) { + isSwitch = true; + end--; + } + ConvertOutput co = code.toSourceOutput(false, false, 0, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, start, end, lrn, fqn, new boolean[code.code.size()]); + output.addAll(co.output); + + } + if (isIf) { + AVM2Instruction ins = code.code.get(end + 1); + if ((stack.size() >= 2) && (ins.definition instanceof IfFalseIns) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { + ret.addAll(output); + + GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); + GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); + boolean reversed = false; + List loopContinues = getLoopsContinues(loops); + loopContinues.add(part); + if (sp1.leadsTo(sp0, loopContinues)) { + } else if (sp0.leadsTo(sp1, loopContinues)) { + reversed = true; + } + GraphPart next = reversed ? sp0 : sp1; + TreeItem ti; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, reversed ? sp1 : sp0, loops, localRegs, body, ignoredSwitches); + TreeItem second = stack.pop(); + TreeItem first = stack.pop(); + if (!reversed) { + AndTreeItem a = new AndTreeItem(ins, first, second); + stack.push(a); + a.firstPart = part; + if (second instanceof AndTreeItem) { + a.firstPart = ((AndTreeItem) second).firstPart; + } + if (second instanceof OrTreeItem) { + a.firstPart = ((AndTreeItem) second).firstPart; + } + } else { + OrTreeItem o = new OrTreeItem(ins, first, second); + stack.push(o); + o.firstPart = part; + if (second instanceof OrTreeItem) { + o.firstPart = ((OrTreeItem) second).firstPart; + } + if (second instanceof OrTreeItem) { + o.firstPart = ((OrTreeItem) second).firstPart; + } + } + next = reversed ? sp1 : sp0; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + return ret; + } else if ((stack.size() >= 2) && (ins.definition instanceof IfTrueIns) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { + ret.addAll(output); + GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); + GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); + boolean reversed = false; + List loopContinues = getLoopsContinues(loops); + loopContinues.add(part); + if (sp1.leadsTo(sp0, loopContinues)) { + } else if (sp0.leadsTo(sp1, loopContinues)) { + reversed = true; + } + GraphPart next = reversed ? sp0 : sp1; + TreeItem ti; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, reversed ? sp1 : sp0, loops, localRegs, body, ignoredSwitches); + TreeItem second = stack.pop(); + TreeItem first = stack.pop(); + if (reversed) { + AndTreeItem a = new AndTreeItem(ins, first, second); + stack.push(a); + a.firstPart = part; + if (second instanceof AndTreeItem) { + a.firstPart = ((AndTreeItem) second).firstPart; + } + if (second instanceof OrTreeItem) { + a.firstPart = ((AndTreeItem) second).firstPart; + } + } else { + OrTreeItem o = new OrTreeItem(ins, first, second); + stack.push(o); + o.firstPart = part; + if (second instanceof OrTreeItem) { + o.firstPart = ((OrTreeItem) second).firstPart; + } + if (second instanceof OrTreeItem) { + o.firstPart = ((OrTreeItem) second).firstPart; + } + } + + next = reversed ? sp1 : sp0; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + + return ret; + } else if ((((ins.definition instanceof IfStrictNeIns)) && ((part.nextParts.get(1).getHeight() == 2) && (code.code.get(part.nextParts.get(1).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) + || (((ins.definition instanceof IfStrictEqIns)) && ((part.nextParts.get(0).getHeight() == 2) && (code.code.get(part.nextParts.get(0).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)))) { + ret.addAll(output); + boolean reversed = false; + if (ins.definition instanceof IfStrictEqIns) { + reversed = true; + } + TreeItem switchedObject = null; + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { + switchedObject = ((SetLocalTreeItem) output.get(output.size() - 1)).value; + } + } + if (switchedObject == null) { + switchedObject = new NullTreeItem(null); + } + HashMap caseValuesMap = new HashMap(); + + stack.pop(); + caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); + + GraphPart switchLoc = part.nextParts.get(reversed ? 0 : 1).nextParts.get(0); + + + while ((code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) + || (code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) { + part = part.nextParts.get(reversed ? 1 : 0); + List ps = part.getSubParts(); + for (GraphPart p : ps) { + code.toSourceOutput(false, false, 0, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, p.start, p.end - 1, lrn, fqn, new boolean[code.code.size()]); + } + stack.pop(); + if (code.code.get(part.end).definition instanceof IfStrictNeIns) { + reversed = false; + } else { + reversed = true; + } + caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); + + } + boolean hasDefault = false; + GraphPart dp = part.nextParts.get(reversed ? 1 : 0); + while (code.code.get(dp.start).definition instanceof JumpIns) { + if (dp instanceof GraphPartMulti) { + dp = ((GraphPartMulti) dp).parts.get(0); + } + dp = dp.nextParts.get(0); + } + if (code.code.get(dp.start).definition instanceof PushByteIns) { + hasDefault = true; + } + List caseValues = new ArrayList(); + for (int i = 0; i < switchLoc.nextParts.size() - 1; i++) { + if (caseValuesMap.containsKey(i)) { + caseValues.add(caseValuesMap.get(i)); + } else { + continue; + } + } + + List> caseCommands = new ArrayList>(); + GraphPart next = null; + + List loopContinues = getLoopsContinues(loops); + + next = switchLoc.getNextPartPath(loopContinues); + if (next == null) { + next = switchLoc.getNextSuperPartPath(loopContinues); + } + + TreeItem ti = checkLoop(next, stopPart, loops); + Loop currentLoop = new Loop(null, next); + loops.add(currentLoop); + //switchLoc.getNextPartPath(new ArrayList()); + List valuesMapping = new ArrayList(); + List caseBodies = new ArrayList(); + for (int i = 0; i < caseValues.size(); i++) { + GraphPart cur = switchLoc.nextParts.get(1 + i); + if (!caseBodies.contains(cur)) { + caseBodies.add(cur); + } + valuesMapping.add(caseBodies.indexOf(cur)); + } + + List defaultCommands = new ArrayList(); + GraphPart defaultPart = null; + if (hasDefault) { + defaultPart = switchLoc.nextParts.get(switchLoc.nextParts.size() - 1); + defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, defaultPart, next, loops, localRegs, body, ignoredSwitches); + } + + List ignored = new ArrayList(); + for (Loop l : loops) { + ignored.add(l.loopContinue); + } + + for (int i = 0; i < caseBodies.size(); i++) { + List cc = new ArrayList(); + GraphPart nextCase = null; + nextCase = next; + if (next != null) { + if (i < caseBodies.size() - 1) { + if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = caseBodies.get(i + 1); + } + } else if (hasDefault) { + if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = defaultPart; + } + } + } + cc.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, caseBodies.get(i), nextCase, loops, localRegs, body, ignoredSwitches)); + caseCommands.add(cc); + } + + SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); + ret.add(sti); + loops.remove(currentLoop); + if (next != null) { + if (ti != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + return ret; + } else { + try { + ins.definition.translate(false, 0, new HashMap(), stack, new Stack(), abc.constants, ins, abc.method_info, output, body, abc, lrn, fqn); + } catch (Exception ex) { + System.err.println("ip:" + (end + 1)); + ex.printStackTrace(); + } + } + //((IfTypeIns)ins.definition).translateInverted(new HashMap(), co.stack, ins); + } + } catch (ConvertException ex) { + Logger.getLogger(AVM2Graph.class.getName()).log(Level.SEVERE, null, ex); + } + + int ip = part.start; + int addr = code.fixAddrAfterDebugLine(code.pos2adr(part.start)); + int maxend = -1; + List catchedExceptions = new ArrayList(); + for (int e = 0; e < body.exceptions.length; e++) { + if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { + if (!body.exceptions[e].isFinally()) { + if (((body.exceptions[e].end) > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) { + catchedExceptions.clear(); + maxend = code.fixAddrAfterDebugLine(body.exceptions[e].end); + catchedExceptions.add(body.exceptions[e]); + } else if (code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) { + catchedExceptions.add(body.exceptions[e]); + } + } + } + } + if (catchedExceptions.size() > 0) { + parsedExceptions.addAll(catchedExceptions); + int endpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end)); + int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); + + + List> catchedCommands = new ArrayList>(); + if (code.code.get(endpos).definition instanceof JumpIns) { + int afterCatchAddr = code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0]; + int afterCatchPos = code.adr2pos(afterCatchAddr); + Collections.sort(catchedExceptions, new Comparator() { + public int compare(ABCException o1, ABCException o2) { + try { + return code.fixAddrAfterDebugLine(o1.target) - code.fixAddrAfterDebugLine(o2.target); + } catch (ConvertException ex) { + return 0; + } + } + }); + + + List finallyCommands = new ArrayList(); + int returnPos = afterCatchPos; + for (int e = 0; e < body.exceptions.length; e++) { + if (body.exceptions[e].isFinally()) { + if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { + if (afterCatchPos + 1 == code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))) { + AVM2Instruction jmpIns = code.code.get(code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))); + if (jmpIns.definition instanceof JumpIns) { + int finStart = code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]); + finallyJumps.add(finStart); + for (int f = finStart; f < code.code.size(); f++) { + if (code.code.get(f).definition instanceof LookupSwitchIns) { + AVM2Instruction swins = code.code.get(f); + if (swins.operands.length >= 3) { + if (swins.operands[0] == swins.getBytes().length) { + if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) { + GraphPart fpart = null; + for (GraphPart p : allParts) { + if (p.start == finStart) { + fpart = p; + break; + } + } + stack.push(new ExceptionTreeItem(body.exceptions[e])); + GraphPart fepart = null; + for (GraphPart p : allParts) { + if (p.start == f + 1) { + fepart = p; + break; + } + } + //code.code.get(f).ignored = true; + ignoredSwitches.add(f); + finallyCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, fpart, fepart, loops, localRegs, body, ignoredSwitches); + returnPos = f + 1; + break; + } + } + } + } + } + + break; + } + } + } + } + } + + for (int e = 0; e < catchedExceptions.size(); e++) { + int eendpos; + if (e < catchedExceptions.size() - 1) { + eendpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2; + } else { + eendpos = afterCatchPos - 1; + } + Stack substack = new Stack(); + substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); + + GraphPart npart = null; + int findpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e).target)); + for (GraphPart p : allParts) { + if (p.start == findpos) { + npart = p; + break; + } + } + + GraphPart nepart = null; + for (GraphPart p : allParts) { + if (p.start == eendpos + 1) { + nepart = p; + break; + } + } + stack.add(new ExceptionTreeItem(catchedExceptions.get(e))); + catchedCommands.add(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, npart, nepart, loops, localRegs, body, ignoredSwitches)); + } + + GraphPart nepart = null; + + for (GraphPart p : allParts) { + if (p.start == endposStartBlock) { + nepart = p; + break; + } + } + List tryCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, part, nepart, loops, localRegs, body, ignoredSwitches); + + output.clear(); + output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); + ip = returnPos; + addr = code.pos2adr(ip); + } + + } + + if (ip != part.start) { + part = null; + for (GraphPart p : allParts) { + List ps = p.getSubParts(); + for (GraphPart p2 : ps) { + if (p2.start == ip) { + part = p2; + break; + } + } + } + ret.addAll(output); + TreeItem lop = checkLoop(part, stopPart, loops); + if (lop == null) { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, part, stopPart, loops, localRegs, body, ignoredSwitches)); + } else { + ret.add(lop); + } + return ret; + } + + List loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + boolean loop = false; + boolean reversed = false; + boolean whileTrue = false; + Loop whileTrueLoop = null; + if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { + if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { + if (output.isEmpty()) { + whileTrueLoop = new Loop(part, null); + loops.add(whileTrueLoop); + whileTrue = true; + } else { + loop = true;//doWhile + } + + } else { + loop = true; + } + } else if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { + loop = true; + reversed = true; + } + if (((part.nextParts.size() == 2) || ((part.nextParts.size() == 1) && loop)) && (!isSwitch)) { + + boolean doWhile = loop; + if (loop && output.isEmpty()) { + doWhile = false; + } + Loop currentLoop = new Loop(part, null); + if (loop) { + loops.add(currentLoop); + } + + loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + + if ((part.nextParts.size() > 1) && (!doWhile)) { + currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); + } + + TreeItem expr = null; + if ((code.code.get(part.end).definition instanceof JumpIns) || (!(code.code.get(part.end).definition instanceof IfTypeIns))) { + expr = new BooleanTreeItem(null, true); + } else { + if (!stack.isEmpty()) { + expr = stack.pop(); + } + } + if (loop) { + if (expr instanceof AndTreeItem) { + currentLoop.loopContinue = ((AndTreeItem) expr).firstPart; + } + if (expr instanceof OrTreeItem) { + currentLoop.loopContinue = ((OrTreeItem) expr).firstPart; + } + } + + if (doWhile) { + //ret.add(new DoWhileTreeItem(null, currentLoop.id, part.start, output, expr)); + } else { + ret.addAll(output); + } + GraphPart loopBodyStart = null; + GraphPart next = part.getNextPartPath(loopContinues); + if (reversed && (expr instanceof LogicalOp)) { + expr = ((LogicalOp) expr).invert(); + } + List retx = ret; + if ((!loop) || (doWhile && (part.nextParts.size() > 1))) { + if (doWhile) { + retx = output; + + } + int stackSizeBefore = stack.size(); + Stack trueStack = (Stack) stack.clone(); + Stack falseStack = (Stack) stack.clone(); + TreeItem lopTrue = checkLoop(part.nextParts.get(1), stopPart, loops); + TreeItem lopFalse = null; + if (next != part.nextParts.get(0)) { + lopFalse = checkLoop(part.nextParts.get(0), stopPart, loops); + } + List onTrue = new ArrayList(); + if (lopTrue != null) { + onTrue.add(lopTrue); + } else { + if (debugMode) { + System.err.println("ONTRUE: (inside " + part + ")"); + } + onTrue = printGraph(methodPath, trueStack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(1), next == null ? stopPart : next, loops, localRegs, body, ignoredSwitches); + if (debugMode) { + System.err.println("/ONTRUE (inside " + part + ")"); + } + } + List onFalse = new ArrayList(); + if (lopFalse != null) { + onFalse.add(lopFalse); + } else { + if (debugMode) { + System.err.println("ONFALSE: (inside " + part + ")"); + } + onFalse = (((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) ? new ArrayList() : printGraph(methodPath, falseStack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(0), next == null ? stopPart : next, loops, localRegs, body, ignoredSwitches)); + if (debugMode) { + System.err.println("/ONFALSE (inside " + part + ")"); + } + } + + if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { + stack.push(new TernarOpTreeItem(null, expr, trueStack.pop(), falseStack.pop())); + } else { + List retw = retx; + if (whileTrue) { + retw = new ArrayList(); + retw.add(new IfTreeItem(null, expr, onTrue, onFalse)); + retx.add(new WhileTreeItem(null, whileTrueLoop.id, whileTrueLoop.loopContinue.start, new BooleanTreeItem(null, true), retw)); + } else { + retx.add(new IfTreeItem(null, expr, onTrue, onFalse)); + } + + //Same continues in onTrue and onFalse gets continue on parent level + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { + if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { + if (((ContinueTreeItem) onTrue.get(onTrue.size() - 1)).loopPos == ((ContinueTreeItem) onFalse.get(onFalse.size() - 1)).loopPos) { + onTrue.remove(onTrue.size() - 1); + retw.add(onFalse.remove(onFalse.size() - 1)); + } + } + } + } + + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onTrue.get(onTrue.size() - 1) instanceof ReturnValueTreeItem || onTrue.get(onTrue.size() - 1) instanceof ReturnVoidTreeItem) { + if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { + retw.add(onFalse.remove(onFalse.size() - 1)); + } + } + } + + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onFalse.get(onFalse.size() - 1) instanceof ReturnValueTreeItem || onFalse.get(onFalse.size() - 1) instanceof ReturnVoidTreeItem) { + if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { + retw.add(onTrue.remove(onTrue.size() - 1)); + } + } + } + if (whileTrue) { + checkContinueAtTheEnd(retw, whileTrueLoop); + } + } + if (doWhile) { + loopBodyStart = next; + } + } + if (loop) { // && (!doWhile)) { + List loopBody = null; + List finalCommands = null; + GraphPart finalPart = null; + boolean isFor = false; + try { + loopBody = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, loopBodyStart != null ? loopBodyStart : part.nextParts.get(reversed ? 1 : 0), stopPart, loops, localRegs, body, ignoredSwitches); + checkContinueAtTheEnd(loopBody, currentLoop); + } catch (ForException fex) { + loopBody = fex.output; + finalCommands = fex.finalOutput; + if (!finalCommands.isEmpty()) { + finalCommands.remove(finalCommands.size() - 1); //remove continue + } + finalPart = fex.continuePart; + isFor = true; + for (Object o : finalPart.forContinues) { + if (o instanceof ContinueTreeItem) { + ((ContinueTreeItem) o).loopPos = currentLoop.id; + } + } + } + if (isFor) { + ret.add(new ForTreeItem(null, currentLoop.id, finalPart.start, new ArrayList(), expr, finalCommands, loopBody)); + } else if ((expr instanceof HasNextTreeItem) && ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister() instanceof FilteredCheckTreeItem) { + TreeItem gti = ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister(); + boolean found = false; + if ((loopBody.size() == 3) || (loopBody.size() == 4)) { + TreeItem ft = loopBody.get(0); + if (ft instanceof WithTreeItem) { + ft = loopBody.get(1); + if (ft instanceof IfTreeItem) { + IfTreeItem ift = (IfTreeItem) ft; + if (ift.onTrue.size() > 0) { + ft = ift.onTrue.get(0); + if (ft instanceof SetPropertyTreeItem) { + SetPropertyTreeItem spt = (SetPropertyTreeItem) ft; + if (spt.object instanceof LocalRegTreeItem) { + int regIndex = ((LocalRegTreeItem) spt.object).regIndex; + HasNextTreeItem iti = (HasNextTreeItem) expr; + localRegs.put(regIndex, new FilterTreeItem(null, iti.collection.getThroughRegister(), ift.expression)); + } + } + } + } + } + } + } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextValueTreeItem)) { + TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); + loopBody.remove(0); + ret.add(new ForEachInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); + } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextNameTreeItem)) { + TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); + loopBody.remove(0); + ret.add(new ForInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); + } else { + if (doWhile) { + if (stack.isEmpty()) { + expr = new BooleanTreeItem(null, true); + } else { + expr = stack.pop(); + } + loopBody.addAll(0, output); + checkContinueAtTheEnd(loopBody, currentLoop); + + List addIf = new ArrayList(); + if ((!loopBody.isEmpty()) && (loopBody.get(loopBody.size() - 1) instanceof IfTreeItem)) { + IfTreeItem ift = (IfTreeItem) loopBody.get(loopBody.size() - 1); + if (ift.onFalse.isEmpty()) { + expr = ift.expression; + addIf = ift.onTrue; + loopBody.remove(loopBody.size() - 1); + } + } + ret.add(new DoWhileTreeItem(null, currentLoop.id, part.start, loopBody, expr)); + ret.addAll(addIf); + + } else { + ret.add(new WhileTreeItem(null, currentLoop.id, part.start, expr, loopBody)); + } + } + } + if ((!doWhile) && (!whileTrue) && loop && (part.nextParts.size() > 1)) { + loops.remove(currentLoop); //remove loop so no break shows up + //ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level, part, part.nextParts.get(reversed ? 0 : 1), stopPart, loops, localRegs, body, ignoredSwitches)); + next = part.nextParts.get(reversed ? 0 : 1); + } + if (doWhile) { + next = null; + } + if (next != null) { + boolean finallyJump = false; + for (int f : finallyJumps) { + if (next.start == f) { + finallyJump = true; + break; + } + } + if (!finallyJump) { + TreeItem ti = checkLoop(next, stopPart, loops); + if (ti != null) { + ret.add(ti); + } else { + if (debugMode) { + System.err.println("NEXT: (inside " + part + ")"); + } + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level, part, next, stopPart, loops, localRegs, body, ignoredSwitches)); + if (debugMode) { + System.err.println("/NEXT: (inside " + part + ")"); + } + } + } + } + } else { + ret.addAll(output); + } + onepart: + if (part.nextParts.size() == 1 && (!loop)) { + if (part.end - part.start > 4) { + if (code.code.get(part.end).definition instanceof PopIns) { + if (code.code.get(part.end - 1).definition instanceof LabelIns) { + if (code.code.get(part.end - 2).definition instanceof PushByteIns) { + + //if (code.code.get(part.end - 3).definition instanceof SetLocalTypeIns) { + if (part.nextParts.size() == 1) { + GraphPart sec = part.nextParts.get(0); + + if (code.code.get(sec.end).definition instanceof ReturnValueIns) { + if (sec.end - sec.start >= 3) { + if (code.code.get(sec.end - 1).definition instanceof KillIns) { + if (code.code.get(sec.end - 2).definition instanceof GetLocalTypeIns) { + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { + sec.ignored = true; + ret.add(new ReturnValueTreeItem(code.code.get(sec.end), ((SetLocalTreeItem) output.get(output.size() - 1)).value)); + break onepart; + } + } + } + } + } + + } else if (code.code.get(sec.end).definition instanceof ReturnVoidIns) { + ret.add(new ReturnVoidTreeItem(code.code.get(sec.end))); + break onepart; + } + //} + } + } + } + } + } + + for (int f : finallyJumps) { + if (part.nextParts.get(0).start == f) { + if ((!output.isEmpty()) && (output.get(output.size() - 1) instanceof SetLocalTreeItem)) { + ret.add(new ReturnValueTreeItem(null, ((SetLocalTreeItem) output.get(output.size() - 1)).value)); + } else { + ret.add(new ReturnVoidTreeItem(null)); + } + + break onepart; + } + } + + GraphPart p = part.nextParts.get(0); + TreeItem lop = checkLoop(p, stopPart, loops); + if (lop == null) { + if (p.path.length() == part.path.length()) { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, p, stopPart, loops, localRegs, body, ignoredSwitches)); + } else { + if ((p != stopPart) && (p.refs.size() > 1)) { + ContinueTreeItem cti = new ContinueTreeItem(null, -1); + //p.forContinues.add(cti); + ret.add(new CommentTreeItem(null, "Unknown jump to part " + p)); + ret.add(cti); + } + } + } else { + ret.add(lop); + } + //} + //ret += (strOfChars(level, TAB) + "continue;\r\n"); + //} + } + if (isSwitch && (!ignoredSwitches.contains(part.end))) { + //ret.add(new CommentTreeItem(code.code.get(part.end), "Switch not supported")); + TreeItem switchedObject = stack.pop(); + List caseValues = new ArrayList(); + List valueMappings = new ArrayList(); + List> caseCommands = new ArrayList>(); + + GraphPart next = part.getNextPartPath(loopContinues); + int breakPos = -1; + if (next != null) { + breakPos = next.start; + } + List defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(0), stopPart, loops, localRegs, body, ignoredSwitches); + + for (int i = 0; i < part.nextParts.size() - 1; i++) { + caseValues.add(new IntegerValueTreeItem(null, (Long) (long) i)); + valueMappings.add(i); + GraphPart nextCase = next; + List caseBody = new ArrayList(); + if (i < part.nextParts.size() - 1 - 1) { + if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(1 + i + 1), new ArrayList())) { + caseBody.add(new BreakTreeItem(null, breakPos)); + } else { + nextCase = part.nextParts.get(1 + i + 1); + } + } else if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(0), new ArrayList())) { + caseBody.add(new BreakTreeItem(null, breakPos)); + } else { + nextCase = part.nextParts.get(0); + } + caseBody.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(1 + i), nextCase, loops, localRegs, body, ignoredSwitches)); + caseCommands.add(caseBody); + } + + SwitchTreeItem swt = new SwitchTreeItem(null, breakPos, switchedObject, caseValues, caseCommands, defaultCommands, valueMappings); + ret.add(swt); + + if (next != null) { + TreeItem lopNext = checkLoop(next, stopPart, loops); + if (lopNext != null) { + ret.add(lopNext); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + + } + + } catch (ForException fex) { + ret.addAll(fex.output); + fex.output = ret; + throw fex; + } + code.clearTemporaryRegisters(ret); + if (!part.forContinues.isEmpty()) { + throw new ForException(new ArrayList(), ret, part); + } + return ret; + } + + private List makeGraph(AVM2Code code, List allBlocks, MethodBody body) { + HashMap> refs = code.visitCode(body); + List ret = new ArrayList(); + boolean visited[] = new boolean[code.code.size()]; + ret.add(makeGraph(null, "0", code, 0, 0, allBlocks, refs, visited)); + for (ABCException ex : body.exceptions) { + GraphPart e1 = new GraphPart(-1, -1); + e1.path = "e"; + GraphPart e2 = new GraphPart(-1, -1); + e2.path = "e"; + GraphPart e3 = new GraphPart(-1, -1); + e3.path = "e"; + makeGraph(e1, "e", code, code.adr2pos(ex.start), code.adr2pos(ex.start), allBlocks, refs, visited); + makeGraph(e2, "e", code, code.adr2pos(ex.end), code.adr2pos(ex.end), allBlocks, refs, visited); + ret.add(makeGraph(e3, "e", code, code.adr2pos(ex.target), code.adr2pos(ex.target), allBlocks, refs, visited)); + } + return ret; + } + + private GraphPart makeGraph(GraphPart parent, String path, AVM2Code code, int startip, int lastIp, List allBlocks, HashMap> refs, boolean visited2[]) { + + int ip = startip; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + p.refs.add(parent); + return p; + } + } + GraphPart g; + GraphPart ret = new GraphPart(ip, -1); + ret.path = path; + GraphPart part = ret; + while (ip < code.code.size()) { + if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) { + part.end = lastIp; + GraphPart found = null; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + found = p; + break; + } + } + + allBlocks.add(part); + + if (found != null) { + part.nextParts.add(found); + found.refs.add(part); + break; + } else { + GraphPart gp = new GraphPart(ip, -1); + gp.path = path; + part.nextParts.add(gp); + gp.refs.add(part); + part = gp; + } + } + lastIp = ip; + AVM2Instruction ins = code.code.get(ip); + if ((ins.definition instanceof ThrowIns) || (ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns)) { + part.end = ip; + allBlocks.add(part); + break; + } + if (ins.definition instanceof LookupSwitchIns) { + part.end = ip; + allBlocks.add(part); + try { + part.nextParts.add(g = makeGraph(part, path + "0", code, code.adr2pos(code.pos2adr(ip) + ins.operands[0]), ip, allBlocks, refs, visited2)); + g.refs.add(part); + for (int i = 2; i < ins.operands.length; i++) { + part.nextParts.add(g = makeGraph(part, path + (i - 1), code, code.adr2pos(code.pos2adr(ip) + ins.operands[i]), ip, allBlocks, refs, visited2)); + g.refs.add(part); + } + break; + } catch (ConvertException ex) { + } + } + if (ins.definition instanceof JumpIns) { + try { + part.end = ip; + allBlocks.add(part); + ip = code.adr2pos(code.pos2adr(ip) + ins.getBytes().length + ins.operands[0]); + part.nextParts.add(g = makeGraph(part, path, code, ip, lastIp, allBlocks, refs, visited2)); + g.refs.add(part); + break; + } catch (ConvertException ex) { + Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex); + } + } else if (ins.definition instanceof IfTypeIns) { + part.end = ip; + allBlocks.add(part); + try { + part.nextParts.add(g = makeGraph(part, path + "0", code, code.adr2pos(code.pos2adr(ip) + ins.getBytes().length + ins.operands[0]), ip, allBlocks, refs, visited2)); + g.refs.add(part); + part.nextParts.add(g = makeGraph(part, path + "1", code, ip + 1, ip, allBlocks, refs, visited2)); + g.refs.add(part); + + } catch (ConvertException ex) { + Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex); + } + break; + } + ip++; + }; + return ret; + }*/ } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java new file mode 100644 index 000000000..d6fff8854 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java @@ -0,0 +1,75 @@ +package com.jpexs.decompiler.flash.abc.avm2.graph; + +import com.jpexs.decompiler.flash.abc.ABC; +import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; +import com.jpexs.decompiler.flash.abc.avm2.ConvertOutput; +import com.jpexs.decompiler.flash.abc.types.MethodBody; +import com.jpexs.decompiler.flash.graph.GraphSource; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Stack; + +/** + * + * @author JPEXS + */ +public class AVM2GraphSource extends GraphSource { + + private AVM2Code code; + boolean isStatic; + int classIndex; + HashMap localRegs; + Stack scopeStack; + ABC abc; + MethodBody body; + HashMap localRegNames; + List fullyQualifiedNames; + + public AVM2GraphSource(AVM2Code code, boolean isStatic, int classIndex, HashMap localRegs, Stack scopeStack, ABC abc, MethodBody body, HashMap localRegNames, List fullyQualifiedNames) { + this.code = code; + this.isStatic = isStatic; + this.classIndex = classIndex; + this.localRegs = localRegs; + this.scopeStack = scopeStack; + this.abc = abc; + this.body = body; + this.localRegNames = localRegNames; + this.fullyQualifiedNames = fullyQualifiedNames; + } + + @Override + public int size() { + return code.code.size(); + } + + @Override + public GraphSourceItem get(int pos) { + return code.code.get(pos); + } + + @Override + public boolean isEmpty() { + return code.code.isEmpty(); + } + + @Override + public List translatePart(List localData, Stack stack, int start, int end) { + List ret = new ArrayList(); + ConvertOutput co = code.toSourceOutput(false, isStatic, classIndex, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()]); + ret.addAll(co.output); + return ret; + } + + @Override + public int adr2pos(long adr) { + return code.adr2pos(adr); + } + + @Override + public long pos2adr(int pos) { + return code.pos2adr(pos); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 98e30c1d4..df5da575a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -16,17 +16,30 @@ */ package com.jpexs.decompiler.flash.abc.avm2.instructions; +import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABCOutputStream; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; +import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.JumpIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.LookupSwitchIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnValueIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnVoidIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ThrowIns; +import com.jpexs.decompiler.flash.abc.types.MethodBody; +import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphSource; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Stack; -public class AVM2Instruction implements Serializable { +public class AVM2Instruction implements Serializable, GraphSourceItem { public InstructionDefinition definition; public int operands[]; @@ -227,4 +240,47 @@ public class AVM2Instruction implements Serializable { return s; } public List replaceWith; + + @Override + public void translate(List localData, Stack stack, List output) { + definition.translate((Boolean) localData.get(0), (Integer) localData.get(1), (HashMap) localData.get(2), stack, (Stack) localData.get(3), (ConstantPool) localData.get(4), this, (MethodInfo[]) localData.get(5), output, (MethodBody) localData.get(6), (ABC) localData.get(7), (HashMap) localData.get(8), (List) localData.get(8)); + } + + @Override + public boolean isJump() { + return (definition instanceof JumpIns); + } + + @Override + public boolean isBranch() { + return (definition instanceof IfTypeIns) || (definition instanceof LookupSwitchIns); + } + + @Override + public boolean isExit() { + return (definition instanceof ReturnValueIns) || (definition instanceof ReturnVoidIns) || (definition instanceof ThrowIns); + } + + @Override + public long getOffset() { + return mappedOffset > -1 ? mappedOffset : offset; + } + + @Override + public List getBranches(GraphSource code) { + List ret = new ArrayList(); + if (definition instanceof IfTypeIns) { + ret.add(code.adr2pos(offset + getBytes().length + operands[0])); + if (!(definition instanceof JumpIns)) { + ret.add(code.adr2pos(offset + getBytes().length)); + } + } + if (definition instanceof LookupSwitchIns) { + ret.add(code.adr2pos(offset + operands[0])); + for (int k = 2; k < operands.length; k++) { + ret.add(code.adr2pos(offset + operands[k])); + } + } + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java index c806be6d9..4d3c2a1f2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.io.Serializable; import java.util.HashMap; @@ -71,10 +72,10 @@ public class InstructionDefinition implements Serializable { throw new UnsupportedOperationException("Instruction " + instructionName + " not implemented"); } - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { } - protected FullMultinameTreeItem resolveMultiname(Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { + protected FullMultinameTreeItem resolveMultiname(Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { TreeItem ns = null; TreeItem name = null; if (constants.constant_multiname[multinameIndex].needsName()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java index 668591a5b..73761062d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIIns.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AddTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class AddIIns extends AddIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new AddTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java index 40cc8b077..a70d46286 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/AddIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AddTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -57,7 +58,7 @@ public class AddIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new AddTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java index 8b98a9a70..6fe60a47b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DecrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -53,7 +54,7 @@ public class DecrementIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java index cf343d9cc..c3bf10e19 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DecrementIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DecrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -53,7 +54,7 @@ public class DecrementIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java index dadbf9c0e..c13a498e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/DivideIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.DivideTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -56,7 +57,7 @@ public class DivideIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new DivideTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIIns.java index 5c06a4d3c..a10922e4e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IncrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class IncrementIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIns.java index 1792bba20..cd1d8e139 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/IncrementIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IncrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class IncrementIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java index 14f102f51..60df8c5f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/ModuloIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.ModuloTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -48,7 +49,7 @@ public class ModuloIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new ModuloTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java index 8a2ad46ca..671cbfb9c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.MultiplyTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class MultiplyIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new MultiplyTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java index 0a68db6a8..412686697 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/MultiplyIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.MultiplyTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -56,7 +57,7 @@ public class MultiplyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new MultiplyTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIIns.java index fb35bc90b..0f056ccb1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NegTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class NegateIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v = (TreeItem) stack.pop(); stack.push(new NegTreeItem(ins, v)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIns.java index a0f602892..bf206f5a4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NegateIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NegTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class NegateIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v = (TreeItem) stack.pop(); stack.push(new NegTreeItem(ins, v)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NotIns.java index 5ef89310a..322cabd5c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/NotIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NotTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class NotIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v = (TreeItem) stack.pop(); stack.push(new NotTreeItem(ins, v)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java index abfc47179..f61ce8642 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.SubtractTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class SubtractIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new SubtractTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java index 09a982632..b3e530af2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/arithmetic/SubtractIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.SubtractTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class SubtractIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new SubtractTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java index 8c69b5ba9..89c5040b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitAndIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.BitAndTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -43,7 +44,7 @@ public class BitAndIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new BitAndTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java index 18833c57c..21bb8bf45 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitNotIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.BitNotTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,7 +43,7 @@ public class BitNotIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v = (TreeItem) stack.pop(); stack.push(new BitNotTreeItem(ins, v)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java index e8f8f61e4..5d7af41cb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitOrIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.BitOrTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -43,7 +44,7 @@ public class BitOrIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new BitOrTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java index fde1197cb..4a3ff506c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/BitXorIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.BitXorTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -43,7 +44,7 @@ public class BitXorIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new BitXorTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java index efc942f34..97bff4946 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/LShiftIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LShiftTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class LShiftIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LShiftTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java index d28c81805..1dccd84f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/RShiftIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.RShiftTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class RShiftIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new RShiftTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java index a1ea7b5c0..f24ee37c1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/bitwise/URShiftIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.URShiftTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class URShiftIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new URShiftTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java index 4ab60f400..8b0d0c616 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/EqualsIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.EqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -43,7 +44,7 @@ public class EqualsIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new EqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java index 6a61a6f1e..f31717578 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterEqualsIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class GreaterEqualsIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java index f76f57724..4cc4d3c02 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/GreaterThanIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class GreaterThanIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java index 670f46c55..2b367cda1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessEqualsIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class LessEqualsIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java index 4262041da..db731255a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/LessThanIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class LessThanIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java index 12a403b51..5850fec3d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/comparsion/StrictEqualsIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.StrictEqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class StrictEqualsIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new StrictEqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java index e446e08e6..0d8437239 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java @@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.XMLTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AddTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -74,7 +75,7 @@ public class ConstructIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; List args = new ArrayList(); for (int a = 0; a < argCount; a++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java index 3d8e820a1..7555ce160 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.XMLTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -54,7 +55,7 @@ public class ConstructPropIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java index 71a19ceff..e676debab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConstructSuperTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +51,7 @@ public class ConstructSuperIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; List args = new ArrayList(); for (int a = 0; a < argCount; a++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewActivationIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewActivationIns.java index f94991b6c..1a2202739 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewActivationIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewActivationIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class NewActivationIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new NewActivationTreeItem(ins)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java index e67030fbe..6bc02ed7d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NewArrayTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -36,7 +37,7 @@ public class NewArrayIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; List args = new ArrayList(); for (int a = 0; a < argCount; a++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewCatchIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewCatchIns.java index 146c7e84a..fa9d1fce7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewCatchIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewCatchIns.java @@ -21,9 +21,9 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ExceptionTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -35,7 +35,7 @@ public class NewCatchIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int exInfo = ins.operands[0]; stack.push(new ExceptionTreeItem(body.exceptions[exInfo])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java index 2f074c34a..143f4a947 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java @@ -21,9 +21,10 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.UnparsedTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -35,9 +36,9 @@ public class NewClassIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int clsIndex = ins.operands[0]; - String baseType = stack.pop().toString(constants, localRegNames, fullyQualifiedNames); + String baseType = stack.pop().toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); stack.push(new UnparsedTreeItem(ins, "new " + abc.constants.constant_multiname[abc.instance_info[clsIndex].name_index].getName(constants, fullyQualifiedNames) + ".class extends " + baseType)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java index e6f3d60d1..d4c854f28 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java @@ -22,9 +22,9 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NewFunctionTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.util.HashMap; import java.util.List; @@ -37,13 +37,13 @@ public class NewFunctionIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int methodIndex = ins.operands[0]; MethodBody mybody = abc.findBody(methodIndex); String bodyStr = ""; String paramStr = ""; if (mybody != null) { - bodyStr = Highlighting.hilighMethodEnd() + mybody.toString("", false, isStatic, classIndex, abc, constants, method_info, new Stack()/*scopeStack*/, false, true, fullyQualifiedNames, null) + Highlighting.hilighMethodBegin(body.method_info); + bodyStr = Highlighting.hilighMethodEnd() + mybody.toString("", false, isStatic, classIndex, abc, constants, method_info, new Stack()/*scopeStack*/, false, true, fullyQualifiedNames, null) + Highlighting.hilighMethodBegin(body.method_info); paramStr = method_info[methodIndex].getParamStr(constants, mybody, abc, fullyQualifiedNames); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java index 17600916d..8bf8306b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.NameValuePair; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NewObjectTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -37,7 +38,7 @@ public class NewObjectIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; List args = new ArrayList(); for (int a = 0; a < argCount; a++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java index e51325fa4..dd1430f36 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +51,7 @@ public class CallIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; List args = new ArrayList(); for (int a = 0; a < argCount; a++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java index 24c76b2d8..f20979e9e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallMethodTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +51,7 @@ public class CallMethodIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int methodIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java index c65cef287..f20593476 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -36,7 +37,7 @@ public class CallPropLexIns extends CallPropertyIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java index cc5bd6cce..794a11d65 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -55,7 +56,7 @@ public class CallPropVoidIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java index cecbb4de3..fc2d9ad24 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -53,7 +54,7 @@ public class CallPropertyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java index 88212c458..258629769 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallStaticTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +51,7 @@ public class CallStaticIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int methodIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java index ee2843b3d..bcf25ff02 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallSuperTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -53,7 +54,7 @@ public class CallSuperIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java index ec70196df..639c5ef45 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.CallSuperTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -53,7 +54,7 @@ public class CallSuperVoidIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; List args = new ArrayList(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java index b8bf76ae8..a30dd92f3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfEqIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.EqTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NeqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfEqIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new EqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfFalseIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfFalseIns.java index 628d6766f..2869cb986 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfFalseIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfFalseIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NotTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class IfFalseIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v1 = (TreeItem) stack.pop(); stack.push(new NotTreeItem(ins, v1)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java index 07c78dd6e..2bba2bdb4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GeTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfGeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java index cf0b544fe..c5dbe9992 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfGtIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GtTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfGtIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java index 80e726cdd..401443574 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GtTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfLeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java index 366865ae9..302c9e19c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfLtIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GeTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfLtIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java index 8849bbf7e..81ca505c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GeTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfNGeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java index 1bdcda8e5..42c25e3e7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNGtIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GtTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfNGtIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new LeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java index 8457135db..f7e60d1e9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GtTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfNLeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GtTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java index e5179f526..ca76417aa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNLtIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.GeTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.LtTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfNLtIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new GeTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java index 252595125..c7c6ce58f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfNeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.EqTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NeqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfNeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new NeqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictEqIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictEqIns.java index a9210d615..86d61df47 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictEqIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictEqIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.StrictEqTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.StrictNeqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new StrictEqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictNeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictNeIns.java index 7d80b931d..5d2fed3ae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictNeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfStrictNeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.StrictEqTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.StrictNeqTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v2 = (TreeItem) stack.pop(); TreeItem v1 = (TreeItem) stack.pop(); stack.push(new StrictNeqTreeItem(ins, v1, v2)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfTrueIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfTrueIns.java index 74c9020b4..f5d9fc6b8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfTrueIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/IfTrueIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.NotTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class IfTrueIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { //String v1 = stack.pop().toString(); //stack.push("(" + v1 + ")"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/JumpIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/JumpIns.java index 34fa3486f..39c9503b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/JumpIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/JumpIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.BooleanTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -35,7 +36,7 @@ public class JumpIns extends InstructionDefinition implements IfTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java index a3e63115c..b1d402dc7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/jumps/LookupSwitchIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class LookupSwitchIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int defaultOffset = ins.operands[0]; int caseCount = ins.operands[1]; //stack.push("switch(...)"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java index 8afdba9cc..89091ccfa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DecLocalTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -54,7 +54,7 @@ public class DecLocalIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regIndex = ins.operands[0]; output.add(new DecLocalTreeItem(ins, regIndex)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java index 72c78d2c0..e69fc2b55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/DecLocalIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DecLocalTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -54,7 +54,7 @@ public class DecLocalIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regIndex = ins.operands[0]; output.add(new DecLocalTreeItem(ins, regIndex)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java index bfd372e8c..85f8d6883 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal0Ins.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ClassTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ThisTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeI } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { if (isStatic) { stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants))); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java index 606385967..7529f4ecb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal1Ins.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeI } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java index f3d4abfc8..ae7d12144 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal2Ins.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeI } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java index f9fd2f92b..0ac4c8eae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocal3Ins.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeI } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java index a37a8f7de..6068bac5a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class GetLocalIns extends InstructionDefinition implements GetLocalTypeIn } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regIndex = ins.operands[0]; stack.push(new LocalRegTreeItem(ins, regIndex, localRegs.get(regIndex))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java index f287b36ca..a71c3950c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IncLocalTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class IncLocalIIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regIndex = ins.operands[0]; output.add(new IncLocalTreeItem(ins, regIndex)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java index 0518ed3f9..74bf3b78d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/IncLocalIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IncLocalTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class IncLocalIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regIndex = ins.operands[0]; output.add(new IncLocalTreeItem(ins, regIndex)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/KillIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/KillIns.java index 3ab569c7d..18616d756 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/KillIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/KillIns.java @@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -33,7 +33,7 @@ public class KillIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { //kill local register } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/SetLocalTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/SetLocalTypeIns.java index 079472721..028569bfc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/SetLocalTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/SetLocalTypeIns.java @@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.PreDecrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.PreIncrementTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -44,7 +45,7 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int regId = getRegisterId(ins); TreeItem value = (TreeItem) stack.pop(); localRegs.put(regId, value); @@ -55,11 +56,11 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S return; } if (value.getNotCoerced() instanceof IncrementTreeItem) { - TreeItem inside = ((IncrementTreeItem) value.getNotCoerced()).object.getNotCoerced(); + GraphTargetItem inside = ((IncrementTreeItem) value.getNotCoerced()).object.getNotCoerced(); if (inside instanceof LocalRegTreeItem) { if (((LocalRegTreeItem) inside).regIndex == regId) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == inside) { stack.pop(); stack.push(new PostIncrementTreeItem(ins, inside)); @@ -78,11 +79,11 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S } if (value.getNotCoerced() instanceof DecrementTreeItem) { - TreeItem inside = ((DecrementTreeItem) value.getNotCoerced()).object.getNotCoerced(); + GraphTargetItem inside = ((DecrementTreeItem) value.getNotCoerced()).object.getNotCoerced(); if (inside instanceof LocalRegTreeItem) { if (((LocalRegTreeItem) inside).regIndex == regId) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == inside) { stack.pop(); stack.push(new PostDecrementTreeItem(ins, inside)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java index 90d78bee2..aff153d01 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.DeletePropertyTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -49,7 +50,7 @@ public class DeletePropertyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); TreeItem obj = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java index e048703c6..0ad91cc63 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java @@ -24,8 +24,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FindPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -46,7 +46,7 @@ public class FindPropertyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); stack.push(new FindPropertyTreeItem(ins, multiname)); //resolve right object diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java index b6961bdf2..520361582 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java @@ -24,8 +24,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FindPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -45,7 +45,7 @@ public class FindPropertyStrictIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); stack.push(new FindPropertyTreeItem(ins, multiname)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java index deec38537..48086020f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.GetDescendantsTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -46,7 +47,7 @@ public class GetDescendantsIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); TreeItem obj = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java index 7450a69c8..534103e3a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ClassTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class GetGlobalScopeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { if (scopeStack.isEmpty()) { stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants))); return; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalSlotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalSlotIns.java index c247564f8..a46086281 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalSlotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalSlotIns.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ExceptionTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -38,7 +39,7 @@ public class GetGlobalSlotIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int slotIndex = ins.operands[0]; TreeItem obj = (TreeItem) scopeStack.get(0); //scope Multiname slotname = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetLexIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetLexIns.java index 14497b3b6..7373df112 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetLexIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetLexIns.java @@ -22,9 +22,9 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.GetLexTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.Multiname; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +36,7 @@ public class GetLexIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; Multiname multiname = constants.constant_multiname[multinameIndex]; stack.push(new GetLexTreeItem(ins, multiname)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetPropertyIns.java index 18c9e7de5..5ec19ab0d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetPropertyIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.GetPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class GetPropertyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); TreeItem obj = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java index 5803af9b3..185253750 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class GetScopeObjectIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int index = ins.operands[0]; if (scopeStack.size() <= index) { System.out.println("uuu"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java index 8d0a37d9e..732fbbd42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java @@ -29,6 +29,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.ExceptionTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +41,7 @@ public class GetSlotIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int slotIndex = ins.operands[0]; TreeItem obj = (TreeItem) stack.pop(); //scope Multiname slotname = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSuperIns.java index c220817a0..19ca0876e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSuperIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.GetSuperTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class GetSuperIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); TreeItem obj = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNext2Ins.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNext2Ins.java index 88ed5cd8f..252f2479d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNext2Ins.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNext2Ins.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.HasNextTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -35,7 +35,7 @@ public class HasNext2Ins extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int objectReg = ins.operands[0]; int indexReg = ins.operands[1]; //stack.push("_loc_" + objectReg + ".hasNext(cnt=_loc_" + indexReg + ")"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNextIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNextIns.java index a6cbca36d..1cfaf3fcf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNextIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/HasNextIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.HasNextTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class HasNextIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem curIndex = (TreeItem) stack.pop(); TreeItem obj = (TreeItem) stack.pop(); stack.push(new HasNextTreeItem(ins, curIndex, obj)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InIns.java index b52860ac3..2a35153ad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.InTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class InIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem obj = (TreeItem) stack.pop(); TreeItem name = (TreeItem) stack.pop(); stack.push(new InTreeItem(ins, name, obj)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InitPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InitPropertyIns.java index 5d6ef42e1..9b8f2212c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InitPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InitPropertyIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.InitPropertyTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class InitPropertyIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; TreeItem val = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextNameIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextNameIns.java index f3e2a7cad..06d8eef2a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextNameIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextNameIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NextNameTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class NextNameIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - TreeItem index = stack.pop(); - TreeItem obj = stack.pop(); + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + GraphTargetItem index = stack.pop(); + GraphTargetItem obj = stack.pop(); stack.push(new NextNameTreeItem(ins, index, obj)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextValueIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextValueIns.java index 037f099ae..c6b49cd10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextValueIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/NextValueIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NextValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class NextValueIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - TreeItem index = stack.pop(); - TreeItem obj = stack.pop(); + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + GraphTargetItem index = stack.pop(); + GraphTargetItem obj = stack.pop(); stack.push(new NextValueTreeItem(ins, index, obj)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java index 5491420d2..1e0e8cd8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ReturnValueTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class ReturnValueIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { output.add(new ReturnValueTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnVoidIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnVoidIns.java index bc4a23e63..4e2682b2a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnVoidIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnVoidIns.java @@ -20,8 +20,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ReturnVoidTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -33,7 +33,7 @@ public class ReturnVoidIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { output.add(new ReturnVoidTreeItem(ins)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetGlobalSlotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetGlobalSlotIns.java index 58e32b644..4d3aa08a8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetGlobalSlotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetGlobalSlotIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.SetTypeIns; import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetGlobalSlotTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class SetGlobalSlotIns extends InstructionDefinition implements SetTypeIn } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { output.add(new SetGlobalSlotTreeItem(ins, ins.operands[0], (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java index 72e572329..b35a9d728 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java @@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.PreDecrementTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.PreIncrementTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -45,23 +46,23 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; TreeItem value = (TreeItem) stack.pop(); FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); TreeItem obj = (TreeItem) stack.pop(); if (value.getThroughRegister() instanceof IncrementTreeItem) { - TreeItem inside = ((IncrementTreeItem) value.getThroughRegister()).object.getThroughRegister().getNotCoerced(); + GraphTargetItem inside = ((IncrementTreeItem) value.getThroughRegister()).object.getThroughRegister().getNotCoerced(); if (inside instanceof GetPropertyTreeItem) { GetPropertyTreeItem insideProp = ((GetPropertyTreeItem) inside); if (insideProp.propertyName.compareSame(multiname)) { - TreeItem insideObj = obj; + GraphTargetItem insideObj = obj; if (insideObj instanceof LocalRegTreeItem) { insideObj = ((LocalRegTreeItem) insideObj).computedValue; } if (insideProp.object == insideObj) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == insideProp) { stack.pop(); stack.push(new PostIncrementTreeItem(ins, insideProp)); @@ -81,17 +82,17 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns } if (value.getThroughRegister() instanceof DecrementTreeItem) { - TreeItem inside = ((DecrementTreeItem) value.getThroughRegister()).object.getThroughRegister().getNotCoerced(); + GraphTargetItem inside = ((DecrementTreeItem) value.getThroughRegister()).object.getThroughRegister().getNotCoerced(); if (inside instanceof GetPropertyTreeItem) { GetPropertyTreeItem insideProp = ((GetPropertyTreeItem) inside); if (insideProp.propertyName.compareSame(multiname)) { - TreeItem insideObj = obj; + GraphTargetItem insideObj = obj; if (insideObj instanceof LocalRegTreeItem) { insideObj = ((LocalRegTreeItem) insideObj).computedValue; } if (insideProp.object == insideObj) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == insideProp) { stack.pop(); stack.push(new PostDecrementTreeItem(ins, insideProp)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java index 5feff25d7..987e46d5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java @@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.PreIncrementTree import com.jpexs.decompiler.flash.abc.types.MethodInfo; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -48,7 +49,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int slotIndex = ins.operands[0]; TreeItem value = (TreeItem) stack.pop(); TreeItem obj = (TreeItem) stack.pop(); //scopeId @@ -79,13 +80,13 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { } if (value.getNotCoerced() instanceof IncrementTreeItem) { - TreeItem inside = ((IncrementTreeItem) value.getNotCoerced()).object.getThroughRegister().getNotCoerced(); + GraphTargetItem inside = ((IncrementTreeItem) value.getNotCoerced()).object.getThroughRegister().getNotCoerced(); if (inside instanceof GetSlotTreeItem) { GetSlotTreeItem slotItem = (GetSlotTreeItem) inside; if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister()) && (slotItem.slotName == slotname)) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == inside) { stack.pop(); stack.push(new PostIncrementTreeItem(ins, inside)); @@ -104,13 +105,13 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { } if (value.getNotCoerced() instanceof DecrementTreeItem) { - TreeItem inside = ((DecrementTreeItem) value.getNotCoerced()).object.getThroughRegister().getNotCoerced(); + GraphTargetItem inside = ((DecrementTreeItem) value.getNotCoerced()).object.getThroughRegister().getNotCoerced(); if (inside instanceof GetSlotTreeItem) { GetSlotTreeItem slotItem = (GetSlotTreeItem) inside; if ((slotItem.scope.getThroughRegister() == obj.getThroughRegister()) && (slotItem.slotName == slotname)) { if (stack.size() > 0) { - TreeItem top = stack.peek().getNotCoerced(); + GraphTargetItem top = stack.peek().getNotCoerced(); if (top == inside) { stack.pop(); stack.push(new PostDecrementTreeItem(ins, inside)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java index 7e7fdab53..1c232246c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetSuperTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -37,7 +38,7 @@ public class SetSuperIns extends InstructionDefinition implements SetTypeIns { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; TreeItem value = (TreeItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java index 76cda70d2..e77805933 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ThrowIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.ThrowTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -35,7 +36,7 @@ public class ThrowIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { output.add(new ThrowTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java index 18165bb13..c36fcf1db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +42,7 @@ public class DupIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem v = (TreeItem) stack.pop(); stack.push(v); stack.push(v); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java index c30ebe2a0..023341bec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.*; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.AssignmentTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,9 +41,9 @@ public class PopIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { if (stack.size() > 0) { - TreeItem top = stack.pop(); + GraphTargetItem top = stack.pop(); if (top instanceof CallPropertyTreeItem) { output.add(top); } else if (top instanceof CallSuperTreeItem) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java index ec91bab07..53cf3bb11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PopScopeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.WithEndTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.WithObjectTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,7 +43,7 @@ public class PopScopeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem scope = (TreeItem) scopeStack.pop(); if (scope instanceof WithObjectTreeItem) { scope = ((WithObjectTreeItem) scope).scope; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java index 6a9713d33..363c19553 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushByteIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushByteIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java index 7a0b9a1b6..ef9712834 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FloatValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushDoubleIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new FloatValueTreeItem(ins, constants.constant_double[ins.operands[0]])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java index 0fddde128..f3c1ff6ff 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class PushFalseIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new BooleanTreeItem(ins, Boolean.FALSE)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java index 7a328e7f6..85b992926 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushIntIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IntegerValueTreeItem(ins, constants.constant_int[ins.operands[0]])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNamespaceIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNamespaceIns.java index fa2f484b1..a438899a6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNamespaceIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNamespaceIns.java @@ -22,9 +22,9 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NameSpaceTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +36,7 @@ public class PushNamespaceIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new NameSpaceTreeItem(ins, ins.operands[0])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNanIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNanIns.java index 2aa3a3129..b9ff30b12 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNanIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNanIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NanTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class PushNanIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new NanTreeItem(ins)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNullIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNullIns.java index baf3639fc..490706ace 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNullIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushNullIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.NullTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class PushNullIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new NullTreeItem(ins)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java index a5051b1e3..50adea0e9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushScopeIns.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -39,7 +39,7 @@ public class PushScopeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { scopeStack.push(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java index d103a91df..19cef12a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushShortIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushShortIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java index 5993060f8..44590fb5c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.StringTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushStringIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new StringTreeItem(ins, constants.constant_string[ins.operands[0]])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java index 5a878314a..75d6785ab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +40,7 @@ public class PushTrueIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new BooleanTreeItem(ins, Boolean.TRUE)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java index d829d6adb..9872ab0cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +41,7 @@ public class PushUIntIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new IntegerValueTreeItem(ins, constants.constant_uint[ins.operands[0]])); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUndefinedIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUndefinedIns.java index deef1b928..dcbee896c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUndefinedIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUndefinedIns.java @@ -20,9 +20,9 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.UndefinedTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class PushUndefinedIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new UndefinedTreeItem(ins)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushWithIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushWithIns.java index 1c9155ffb..40c61756a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushWithIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushWithIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.WithObjectTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.WithTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class PushWithIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem w = (TreeItem) stack.pop(); WithObjectTreeItem wot = new WithObjectTreeItem(ins, w); scopeStack.push(wot); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java index df3573a59..380308c3c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/SwapIns.java @@ -21,9 +21,9 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -43,10 +43,10 @@ public class SwapIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - TreeItem o1 = stack.pop(); - TreeItem o2 = stack.pop(); + GraphTargetItem o1 = stack.pop(); + GraphTargetItem o2 = stack.pop(); stack.push(o1); stack.push(o2); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java index 5d503e543..3c155d96a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java @@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ApplyTypeTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.*; public class ApplyTypeIns extends InstructionDefinition { @@ -45,9 +45,9 @@ public class ApplyTypeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List params = new ArrayList(); + List params = new ArrayList(); for (int i = 0; i < argCount; i++) { params.add(0, stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java index d7a517392..c7763efc4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeIns.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AsTypeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -47,7 +48,7 @@ public class AsTypeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem val = (TreeItem) stack.pop(); stack.push(new AsTypeTreeItem(ins, val, new FullMultinameTreeItem(ins, ins.operands[0]))); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java index e1e9d1b42..b1aed6759 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/AsTypeLateIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.AsTypeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -44,7 +45,7 @@ public class AsTypeLateIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem cls = (TreeItem) stack.pop(); TreeItem val = (TreeItem) stack.pop(); stack.push(new AsTypeTreeItem(ins, val, cls)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java index c8ce22fff..e0710e405 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CoerceTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -44,7 +45,7 @@ public class CoerceAIns extends InstructionDefinition implements CoerceOrConvert } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java index 9132655c0..01604f825 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CoerceTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,7 +43,7 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), constants.constant_multiname[multinameIndex].getName(constants, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java index 09190c28f..c43e6b6a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.CoerceTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +42,7 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java index b13fcd54d..3048e64d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -51,7 +52,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java index b188b3f93..740d6e004 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -59,7 +60,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java index 4bdd1c54f..56e60d6d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -57,7 +58,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java index 8f5c66610..a440db938 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +41,7 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java index 9b759dae1..9326fc5e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,7 +42,7 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java index e4c7c5a27..894f8eb4a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,7 +41,7 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), getTargetType(constants, ins, fullyQualifiedNames))); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/InstanceOfIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/InstanceOfIns.java index 20aa7846d..5a38441cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/InstanceOfIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/InstanceOfIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.InstanceOfTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class InstanceOfIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem type = (TreeItem) stack.pop(); TreeItem value = (TreeItem) stack.pop(); stack.push(new InstanceOfTreeItem(ins, value, type)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeIns.java index 3caad6054..0fbbb985a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeIns.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.FullMultinameTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.IsTypeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -36,7 +37,7 @@ public class IsTypeIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; TreeItem value = (TreeItem) stack.pop(); stack.push(new IsTypeTreeItem(ins, value, new FullMultinameTreeItem(ins, multinameIndex))); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeLateIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeLateIns.java index d6066d546..4cf6d1906 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeLateIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/IsTypeLateIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.IsTypeTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class IsTypeLateIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { TreeItem type = (TreeItem) stack.pop(); TreeItem value = (TreeItem) stack.pop(); stack.push(new IsTypeTreeItem(ins, value, type)); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java index cff241f5a..9cb4f6dda 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/TypeOfIns.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.operations.TypeOfTreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -34,7 +35,7 @@ public class TypeOfIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new TypeOfTreeItem(ins, (TreeItem) stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java index 074fce387..23a9cc4b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/CheckFilterIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.FilteredCheckTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -40,8 +40,8 @@ public class CheckFilterIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - TreeItem obj = stack.pop(); + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + GraphTargetItem obj = stack.pop(); stack.push(new FilteredCheckTreeItem(ins, obj)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java index 6194bd9a7..528a22a72 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java @@ -24,9 +24,9 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DefaultXMLNamespace; import com.jpexs.decompiler.flash.abc.avm2.treemodel.StringTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -46,7 +46,7 @@ public class DXNSIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc, HashMap localRegNames, List fullyQualifiedNames) { output.add(new DefaultXMLNamespace(ins, new StringTreeItem(ins, constants.constant_string[ins.operands[0]]))); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java index 18859d0ed..2a7651004 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSLateIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.DefaultXMLNamespace; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -41,8 +41,8 @@ public class DXNSLateIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { - TreeItem xmlns = stack.pop(); + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + GraphTargetItem xmlns = stack.pop(); output.add(new DefaultXMLNamespace(ins, xmlns)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java index 76180b776..50b20a5eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXAttrIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.EscapeXAttrTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,7 +42,7 @@ public class EscXAttrIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new EscapeXAttrTreeItem(ins, stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java index de1d83a35..3b157cb8c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/EscXElemIns.java @@ -22,8 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.treemodel.EscapeXElemTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,7 +42,7 @@ public class EscXElemIns extends InstructionDefinition { } @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { stack.push(new EscapeXElemTreeItem(ins, stack.pop())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java index 98c89efcf..bfa24bcb5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ApplyTypeTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; public class ApplyTypeTreeItem extends TreeItem { - public TreeItem object; - public List params; + public GraphTargetItem object; + public List params; - public ApplyTypeTreeItem(AVM2Instruction instruction, TreeItem object, List params) { + public ApplyTypeTreeItem(AVM2Instruction instruction, GraphTargetItem object, List params) { super(instruction, PRECEDENCE_PRIMARY); this.params = params; this.object = object; @@ -34,18 +36,18 @@ public class ApplyTypeTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = object.toString(constants, localRegNames, fullyQualifiedNames); + String ret = object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); if (!params.isEmpty()) { ret += hilight(".<"); for (int i = 0; i < params.size(); i++) { if (i > 0) { ret += hilight(","); } - TreeItem p = params.get(i); + GraphTargetItem p = params.get(i); if (p instanceof NullTreeItem) { ret += "*"; } else { - ret += p.toString(constants, localRegNames, fullyQualifiedNames); + ret += p.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } } ret += hilight(">"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/BreakTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/BreakTreeItem.java deleted file mode 100644 index 9aeb88725..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/BreakTreeItem.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import java.util.HashMap; -import java.util.List; - -public class BreakTreeItem extends TreeItem { - - public long loopPos; - public boolean isKnown; - - public BreakTreeItem(AVM2Instruction instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public BreakTreeItem(AVM2Instruction instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return hilight("break") + " loop" + loopPos; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/CoerceTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/CoerceTreeItem.java index 994f28e97..d0f49cb83 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/CoerceTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/CoerceTreeItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; @@ -39,7 +40,7 @@ public class CoerceTreeItem extends TreeItem { } @Override - public TreeItem getNotCoerced() { + public GraphTargetItem getNotCoerced() { return value; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ContinueTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ContinueTreeItem.java deleted file mode 100644 index d11415bf0..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ContinueTreeItem.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import java.util.HashMap; -import java.util.List; - -public class ContinueTreeItem extends TreeItem { - - public long loopPos; - public boolean isKnown; - - public ContinueTreeItem(AVM2Instruction instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public ContinueTreeItem(AVM2Instruction instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return hilight("continue") + " " + (isKnown ? "loop" : "unk") + loopPos; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ConvertTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ConvertTreeItem.java index 3179c892c..1d7d95da8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ConvertTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/ConvertTreeItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; @@ -39,7 +40,7 @@ public class ConvertTreeItem extends TreeItem { } @Override - public TreeItem getNotCoerced() { + public GraphTargetItem getNotCoerced() { return value; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/DefaultXMLNamespace.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/DefaultXMLNamespace.java index 6976c601a..b8a09ad8d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/DefaultXMLNamespace.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/DefaultXMLNamespace.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,15 +29,15 @@ import java.util.List; */ public class DefaultXMLNamespace extends TreeItem { - private TreeItem ns; + private GraphTargetItem ns; - public DefaultXMLNamespace(AVM2Instruction instruction, TreeItem ns) { + public DefaultXMLNamespace(AVM2Instruction instruction, GraphTargetItem ns) { super(instruction, NOPRECEDENCE); this.ns = ns; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return hilight("default xml namespace = ") + ns.toString(constants, localRegNames, fullyQualifiedNames); + return hilight("default xml namespace = ") + ns.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXAttrTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXAttrTreeItem.java index ce3455a9b..d7d7d8fa7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXAttrTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXAttrTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,15 +29,15 @@ import java.util.List; */ public class EscapeXAttrTreeItem extends TreeItem { - public TreeItem expression; + public GraphTargetItem expression; - public EscapeXAttrTreeItem(AVM2Instruction instruction, TreeItem expression) { + public EscapeXAttrTreeItem(AVM2Instruction instruction, GraphTargetItem expression) { super(instruction, NOPRECEDENCE); this.expression = expression; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return hilight("{") + expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight("}"); + return hilight("{") + expression.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight("}"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXElemTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXElemTreeItem.java index 7eaa2be09..55d919a4a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXElemTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/EscapeXElemTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,15 +29,15 @@ import java.util.List; */ public class EscapeXElemTreeItem extends TreeItem { - public TreeItem expression; + public GraphTargetItem expression; - public EscapeXElemTreeItem(AVM2Instruction instruction, TreeItem expression) { + public EscapeXElemTreeItem(AVM2Instruction instruction, GraphTargetItem expression) { super(instruction, NOPRECEDENCE); this.expression = expression; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return hilight("{") + expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight("}"); + return hilight("{") + expression.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight("}"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FilteredCheckTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FilteredCheckTreeItem.java index d812e6080..14eb4d21f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FilteredCheckTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FilteredCheckTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,15 +29,15 @@ import java.util.List; */ public class FilteredCheckTreeItem extends TreeItem { - TreeItem object; + GraphTargetItem object; - public FilteredCheckTreeItem(AVM2Instruction instruction, TreeItem object) { + public FilteredCheckTreeItem(AVM2Instruction instruction, GraphTargetItem object) { super(instruction, NOPRECEDENCE); this.object = object; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return object.toString(constants, localRegNames, fullyQualifiedNames); + return object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FullMultinameTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FullMultinameTreeItem.java index fa495d60a..165b8a7a9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FullMultinameTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/FullMultinameTreeItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.types.Namespace; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.HashMap; import java.util.List; @@ -95,12 +96,12 @@ public class FullMultinameTreeItem extends TreeItem { if (multinameIndex != other.multinameIndex) { return false; } - TreeItem tiName = name; + GraphTargetItem tiName = name; while (tiName instanceof LocalRegTreeItem) { tiName = ((LocalRegTreeItem) tiName).computedValue; } - TreeItem tiName2 = other.name; + GraphTargetItem tiName2 = other.name; while (tiName2 instanceof LocalRegTreeItem) { tiName2 = ((LocalRegTreeItem) tiName2).computedValue; } @@ -108,12 +109,12 @@ public class FullMultinameTreeItem extends TreeItem { return false; } - TreeItem tiNameSpace = namespace; + GraphTargetItem tiNameSpace = namespace; while (tiNameSpace instanceof LocalRegTreeItem) { tiNameSpace = ((LocalRegTreeItem) tiNameSpace).computedValue; } - TreeItem tiNameSpace2 = other.namespace; + GraphTargetItem tiNameSpace2 = other.namespace; while (tiNameSpace2 instanceof LocalRegTreeItem) { tiNameSpace2 = ((LocalRegTreeItem) tiNameSpace2).computedValue; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/HasNextTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/HasNextTreeItem.java index d00efa917..512e4c4ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/HasNextTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/HasNextTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,10 +29,10 @@ import java.util.List; */ public class HasNextTreeItem extends TreeItem { - public TreeItem object; - public TreeItem collection; + public GraphTargetItem object; + public GraphTargetItem collection; - public HasNextTreeItem(AVM2Instruction instruction, TreeItem object, TreeItem collection) { + public HasNextTreeItem(AVM2Instruction instruction, GraphTargetItem object, GraphTargetItem collection) { super(instruction, NOPRECEDENCE); this.object = object; this.collection = collection; @@ -38,6 +40,6 @@ public class HasNextTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return collection.toString(constants, localRegNames, fullyQualifiedNames) + " hasNext " + object.toString(constants, localRegNames, fullyQualifiedNames); + return collection.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + " hasNext " + object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/LocalRegTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/LocalRegTreeItem.java index 88226ab9c..1bd7387d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/LocalRegTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/LocalRegTreeItem.java @@ -19,15 +19,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.FilterTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; public class LocalRegTreeItem extends TreeItem { public int regIndex; - public TreeItem computedValue; + public GraphTargetItem computedValue; - public LocalRegTreeItem(AVM2Instruction instruction, int regIndex, TreeItem computedValue) { + public LocalRegTreeItem(AVM2Instruction instruction, int regIndex, GraphTargetItem computedValue) { super(instruction, PRECEDENCE_PRIMARY); this.regIndex = regIndex; if (computedValue == null) { @@ -39,23 +41,13 @@ public class LocalRegTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { if (computedValue instanceof FilterTreeItem) { - return computedValue.toString(constants, localRegNames, fullyQualifiedNames); + return computedValue.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } return hilight(localRegName(localRegNames, regIndex)); } @Override - public boolean isFalse() { - return computedValue.isFalse(); - } - - @Override - public boolean isTrue() { - return computedValue.isTrue(); - } - - @Override - public TreeItem getThroughRegister() { + public GraphTargetItem getThroughRegister() { return computedValue.getThroughRegister(); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextNameTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextNameTreeItem.java index c1829e7eb..e6fa4b4c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextNameTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextNameTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,10 +29,10 @@ import java.util.List; */ public class NextNameTreeItem extends TreeItem { - TreeItem index; - TreeItem obj; + GraphTargetItem index; + GraphTargetItem obj; - public NextNameTreeItem(AVM2Instruction instruction, TreeItem index, TreeItem obj) { + public NextNameTreeItem(AVM2Instruction instruction, GraphTargetItem index, GraphTargetItem obj) { super(instruction, NOPRECEDENCE); this.index = index; this.obj = obj; @@ -38,6 +40,6 @@ public class NextNameTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return "nextName(" + index.toString(constants, localRegNames, fullyQualifiedNames) + "," + obj.toString(constants, localRegNames, fullyQualifiedNames) + ")"; + return "nextName(" + index.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "," + obj.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + ")"; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextValueTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextValueTreeItem.java index 9102ae3b0..1f17dd590 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextValueTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NextValueTreeItem.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -27,10 +29,10 @@ import java.util.List; */ public class NextValueTreeItem extends TreeItem { - TreeItem index; - TreeItem obj; + GraphTargetItem index; + GraphTargetItem obj; - public NextValueTreeItem(AVM2Instruction instruction, TreeItem index, TreeItem obj) { + public NextValueTreeItem(AVM2Instruction instruction, GraphTargetItem index, GraphTargetItem obj) { super(instruction, NOPRECEDENCE); this.index = index; this.obj = obj; @@ -38,6 +40,6 @@ public class NextValueTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return "nextValue(" + index.toString(constants, localRegNames, fullyQualifiedNames) + "," + obj.toString(constants, localRegNames, fullyQualifiedNames) + ")"; + return "nextValue(" + index.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "," + obj.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + ")"; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostDecrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostDecrementTreeItem.java index 08eb1d9fd..b33b696d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostDecrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostDecrementTreeItem.java @@ -19,20 +19,22 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.AssignmentTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; public class PostDecrementTreeItem extends TreeItem implements AssignmentTreeItem { - public TreeItem object; + public GraphTargetItem object; - public PostDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { + public PostDecrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_POSTFIX); this.object = object; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return object.toString(constants, localRegNames, fullyQualifiedNames) + hilight("--"); + return object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight("--"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostIncrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostIncrementTreeItem.java index 992f70bd0..4abc2588c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostIncrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/PostIncrementTreeItem.java @@ -19,20 +19,22 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.AssignmentTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; public class PostIncrementTreeItem extends TreeItem implements AssignmentTreeItem { - public TreeItem object; + public GraphTargetItem object; - public PostIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { + public PostIncrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_POSTFIX); this.object = object; } @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return object.toString(constants, localRegNames, fullyQualifiedNames) + hilight("++"); + return object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + hilight("++"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/TreeItem.java index 272977999..5a1d15223 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/TreeItem.java @@ -18,36 +18,24 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.util.HashMap; import java.util.List; -public abstract class TreeItem { +public abstract class TreeItem extends GraphTargetItem { - public static final int PRECEDENCE_PRIMARY = 0; - public static final int PRECEDENCE_POSTFIX = 1; - public static final int PRECEDENCE_UNARY = 2; - public static final int PRECEDENCE_MULTIPLICATIVE = 3; - public static final int PRECEDENCE_ADDITIVE = 4; - public static final int PRECEDENCE_BITWISESHIFT = 5; - public static final int PRECEDENCE_RELATIONAL = 6; - public static final int PRECEDENCE_EQUALITY = 7; - public static final int PRECEDENCE_BITWISEAND = 8; - public static final int PRECEDENCE_BITWISEXOR = 9; - public static final int PRECEDENCE_BITWISEOR = 10; - public static final int PRECEDENCE_LOGICALAND = 11; - public static final int PRECEDENCE_LOGICALOR = 12; - public static final int PRECEDENCE_CONDITIONAL = 13; - public static final int PRECEDENCE_ASSIGMENT = 14; - public static final int PRECEDENCE_COMMA = 15; - public static final int NOPRECEDENCE = 16; - public int precedence = NOPRECEDENCE; public AVM2Instruction instruction; public boolean hidden = false; - public TreeItem(AVM2Instruction instruction, int precedence) { - this.instruction = instruction; - this.precedence = precedence; + public TreeItem(GraphSourceItem instruction, int precedence) { + super(instruction, precedence); + } + + @Override + public String toString(List localData) { + return toString((ConstantPool) localData.get(0), (HashMap) localData.get(1), (List) localData.get(2)); } public abstract String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames); @@ -60,21 +48,21 @@ public abstract class TreeItem { return toString(constants, localRegNames, fullyQualifiedNames) + (needsSemicolon() ? ";" : ""); } + @Override public boolean needsSemicolon() { return true; } - protected String hilight(String str) { - if (instruction == null) { - return str; - } - if (instruction.mappedOffset >= 0) { - return Highlighting.hilighOffset(str, instruction.mappedOffset); - } else { - return Highlighting.hilighOffset(str, instruction.offset); - } - } - + /*public String hilight(String str) { + if (instruction == null) { + return str; + } + if (instruction.mappedOffset >= 0) { + return Highlighting.hilighOffset(str, instruction.mappedOffset); + } else { + return Highlighting.hilighOffset(str, instruction.offset); + } + }*/ public boolean isFalse() { return false; } @@ -117,14 +105,6 @@ public abstract class TreeItem { return prefix + name; } - public TreeItem getNotCoerced() { - return this; - } - - public TreeItem getThroughRegister() { - return this; - } - public static String localRegName(HashMap localRegNames, int reg) { if (localRegNames.containsKey(reg)) { return localRegNames.get(reg); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DeclarationTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DeclarationTreeItem.java index 14d25144b..35dee78d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DeclarationTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DeclarationTreeItem.java @@ -22,6 +22,8 @@ import com.jpexs.decompiler.flash.abc.avm2.treemodel.ConvertTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetLocalTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.SetSlotTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; @@ -31,16 +33,16 @@ import java.util.List; */ public class DeclarationTreeItem extends TreeItem { - public TreeItem assignment; + public GraphTargetItem assignment; public String type; - public DeclarationTreeItem(TreeItem assignment, String type) { - super(assignment.instruction, assignment.precedence); + public DeclarationTreeItem(GraphTargetItem assignment, String type) { + super(assignment.src, assignment.precedence); this.type = type; this.assignment = assignment; } - public DeclarationTreeItem(TreeItem assignment) { + public DeclarationTreeItem(GraphTargetItem assignment) { this(assignment, null); } @@ -61,6 +63,6 @@ public class DeclarationTreeItem extends TreeItem { SetSlotTreeItem ssti = (SetSlotTreeItem) assignment; return "var " + ssti.getName(constants, localRegNames, fullyQualifiedNames) + ":" + type + hilight(" = ") + ssti.value.toString(constants, localRegNames, fullyQualifiedNames); } - return "var " + assignment.toString(constants, localRegNames, fullyQualifiedNames); + return "var " + assignment.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DoWhileTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DoWhileTreeItem.java deleted file mode 100644 index a9a579641..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/DoWhileTreeItem.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class DoWhileTreeItem extends LoopTreeItem implements Block { - - public List commands; - public TreeItem expression; - - @Override - public boolean needsSemicolon() { - return false; - } - - public DoWhileTreeItem(AVM2Instruction instruction, long loopId, int loopContinue, List commands, TreeItem expression) { - super(instruction, loopId, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = ""; - ret += "loop" + loopId + ":\r\n"; - ret += hilight("do\r\n{") + "\r\n"; - for (TreeItem ti : commands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += hilight("}\r\nwhile(") + expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight(");") + "\r\n"; - ret += ":loop" + loopId; - - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java index 3a068ec4f..8931db9c0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java @@ -19,6 +19,9 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.*; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -67,11 +70,11 @@ public class ForEachInTreeItem extends LoopTreeItem implements Block { return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java index eca78ce01..bb97aec49 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java @@ -19,6 +19,9 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.*; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -67,11 +70,11 @@ public class ForInTreeItem extends LoopTreeItem implements Block { return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForTreeItem.java deleted file mode 100644 index 442553c46..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForTreeItem.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class ForTreeItem extends LoopTreeItem implements Block { - - public List firstCommands; - public TreeItem expression; - public List finalCommands; - public List commands; - - public ForTreeItem(AVM2Instruction instruction, long loopBreak, int loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { - super(instruction, loopBreak, loopContinue); - this.firstCommands = firstCommands; - this.expression = expression; - this.finalCommands = finalCommands; - this.commands = commands; - } - - private String stripSemicolon(String s) { - if (s.endsWith(";")) { - s = s.substring(0, s.length() - 1); - } - return s; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = ""; - ret += "loop" + loopId + ":\r\n"; - ret += hilight("for("); - for (int i = 0; i < firstCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(firstCommands.get(i).toString(constants, localRegNames, fullyQualifiedNames)); - } - ret += ";"; - ret += expression.toString(constants, localRegNames, fullyQualifiedNames); - ret += ";"; - for (int i = 0; i < finalCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(finalCommands.get(i).toString(constants, localRegNames, fullyQualifiedNames)); - } - ret += hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : commands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopId; - return ret; - } - - @Override - public boolean needsSemicolon() { - return false; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/IfTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/IfTreeItem.java deleted file mode 100644 index 74c8b8141..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/IfTreeItem.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class IfTreeItem extends TreeItem implements Block { - - public TreeItem expression; - public List onTrue; - public List onFalse; - - public IfTreeItem(AVM2Instruction instruction, TreeItem expression, List onTrue, List onFalse) { - super(instruction, NOPRECEDENCE); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret; - ret = hilight("if(") + expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : onTrue) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += hilight("}"); - if (onFalse.size() > 0) { - ret += "\r\n" + hilight("else") + "\r\n" + hilight("{") + "\r\n"; - for (TreeItem ti : onFalse) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += hilight("}"); - } - return ret; - } - - @Override - public boolean needsSemicolon() { - return false; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : onTrue) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - for (TreeItem ti : onFalse) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/SwitchTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/SwitchTreeItem.java deleted file mode 100644 index 01a67042b..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/SwitchTreeItem.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.BreakTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class SwitchTreeItem extends LoopTreeItem implements Block { - - public TreeItem switchedObject; - public List caseValues; - public List> caseCommands; - public List defaultCommands; - public List valuesMapping; - - public SwitchTreeItem(AVM2Instruction instruction, int switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands, List valuesMapping) { - super(instruction, switchBreak, -1); - this.switchedObject = switchedObject; - this.caseValues = caseValues; - this.caseCommands = caseCommands; - this.defaultCommands = defaultCommands; - this.valuesMapping = valuesMapping; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = ""; - ret += "loop" + loopId + ":\r\n"; - ret += hilight("switch(") + switchedObject.toString(constants, localRegNames, fullyQualifiedNames) + hilight(")") + "\r\n{\r\n"; - for (int i = 0; i < caseCommands.size(); i++) { - for (int k = 0; k < valuesMapping.size(); k++) { - if (valuesMapping.get(k) == i) { - ret += "case " + caseValues.get(k).toString(constants, localRegNames, fullyQualifiedNames) + ":\r\n"; - } - } - ret += AVM2Code.IDENTOPEN + "\r\n"; - for (int j = 0; j < caseCommands.get(i).size(); j++) { - ret += caseCommands.get(i).get(j).toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += AVM2Code.IDENTCLOSE + "\r\n"; - } - if (defaultCommands.size() > 0) { - if (!((defaultCommands.size() == 1) && (defaultCommands.get(0) instanceof BreakTreeItem) && (((BreakTreeItem) defaultCommands.get(0)).loopPos == loopId))) { - ret += hilight("default") + ":\r\n"; - ret += AVM2Code.IDENTOPEN + "\r\n"; - for (int j = 0; j < defaultCommands.size(); j++) { - ret += defaultCommands.get(j).toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += AVM2Code.IDENTCLOSE + "\r\n"; - } - - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopId; - return ret; - } - - @Override - public boolean needsSemicolon() { - return false; - } - - public List getContinues() { - List ret = new ArrayList(); - - for (List onecase : caseCommands) { - for (TreeItem ti : onecase) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - - for (TreeItem ti : defaultCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java index 1556aab5c..ffaab3bba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java @@ -17,21 +17,24 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.ABCException; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class TryTreeItem extends TreeItem implements Block { - public List tryCommands; + public List tryCommands; public List catchExceptions; - public List> catchCommands; - public List finallyCommands; + public List> catchCommands; + public List finallyCommands; - public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { + public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { super(null, NOPRECEDENCE); this.tryCommands = tryCommands; this.catchExceptions = catchExceptions; @@ -43,52 +46,52 @@ public class TryTreeItem extends TreeItem implements Block { public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { String ret = ""; ret += "try\r\n{\r\n"; - for (TreeItem ti : tryCommands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; + for (GraphTargetItem ti : tryCommands) { + ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n"; } ret += "}"; for (int e = 0; e < catchExceptions.size(); e++) { ret += "\r\ncatch(" + catchExceptions.get(e).getVarName(constants, fullyQualifiedNames) + ":" + catchExceptions.get(e).getTypeName(constants, fullyQualifiedNames) + ")\r\n{\r\n"; - List commands = catchCommands.get(e); - for (TreeItem ti : commands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; + List commands = catchCommands.get(e); + for (GraphTargetItem ti : commands) { + ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n"; } ret += "}"; } if (finallyCommands.size() > 0) { ret += "\r\nfinally\r\n{\r\n"; - for (TreeItem ti : finallyCommands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; + for (GraphTargetItem ti : finallyCommands) { + ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n"; } ret += "}"; } return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : tryCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : tryCommands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); } } if (finallyCommands != null) { - for (TreeItem ti : finallyCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (GraphTargetItem ti : finallyCommands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); } } } - for (List commands : catchCommands) { - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (List commands : catchCommands) { + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/WhileTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/WhileTreeItem.java deleted file mode 100644 index ea9e7ca51..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/WhileTreeItem.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class WhileTreeItem extends LoopTreeItem implements Block { - - public TreeItem expression; - public List commands; - - public WhileTreeItem(AVM2Instruction instruction, long loopId, int loopContinue, TreeItem expression, List commands) { - super(instruction, loopId, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String ret = ""; - ret += "loop" + loopId + ":\r\n"; - ret += hilight("while(") + expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : commands) { - ret += ti.toStringSemicoloned(constants, localRegNames, fullyQualifiedNames) + "\r\n"; - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopId; - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } - - @Override - public boolean needsSemicolon() { - return false; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/EqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/EqTreeItem.java index 8ade7feda..2a1524c80 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/EqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/EqTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class EqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class EqTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public EqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new NeqTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GeTreeItem.java index 458f759bb..d71968c45 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GeTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class GeTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class GeTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public GeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new LtTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GtTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GtTreeItem.java index 384333d04..c36f58242 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GtTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/GtTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class GtTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class GtTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public GtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new LeTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LeTreeItem.java index ec1f91563..1456ce909 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LeTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class LeTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class LeTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public LeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new GtTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LogicalOp.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LogicalOp.java deleted file mode 100644 index 32bef8c53..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LogicalOp.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; - -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; - -/** - * - * @author JPEXS - */ -public interface LogicalOp { - - public TreeItem invert(); -} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LtTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LtTreeItem.java index 569710f44..85038f999 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LtTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/LtTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class LtTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class LtTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public LtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new GeTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NeqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NeqTreeItem.java index 1098d287d..19445ef37 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NeqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NeqTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class NeqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class NeqTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public NeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new EqTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NotTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NotTreeItem.java index 5c2a2e334..303320027 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NotTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/NotTreeItem.java @@ -17,26 +17,23 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; +import com.jpexs.decompiler.flash.graph.NotItem; -public class NotTreeItem extends UnaryOpTreeItem implements LogicalOp { +public class NotTreeItem extends UnaryOpTreeItem implements LogicalOpItem, NotItem { - public NotTreeItem(AVM2Instruction instruction, TreeItem value) { + public NotTreeItem(AVM2Instruction instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_UNARY, value, "!"); } @Override - public boolean isTrue() { - return !value.isTrue(); + public GraphTargetItem invert() { + return value; } @Override - public boolean isFalse() { - return !value.isFalse(); - } - - @Override - public TreeItem invert() { + public GraphTargetItem getOriginal() { return value; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreDecrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreDecrementTreeItem.java index 9547f85f6..ab03932c3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreDecrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreDecrementTreeItem.java @@ -17,12 +17,12 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses.AssignmentTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; public class PreDecrementTreeItem extends UnaryOpTreeItem implements AssignmentTreeItem { - public PreDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { + public PreDecrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_UNARY, object, "--"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreIncrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreIncrementTreeItem.java index 3936c58b4..2c42de3a8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreIncrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/PreIncrementTreeItem.java @@ -17,11 +17,11 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; public class PreIncrementTreeItem extends UnaryOpTreeItem { - public PreIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { + public PreIncrementTreeItem(AVM2Instruction instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_UNARY, object, "++"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictEqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictEqTreeItem.java index 79de6f36d..322c611da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictEqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictEqTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class StrictEqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class StrictEqTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public StrictEqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new StrictNeqTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictNeqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictNeqTreeItem.java index cab25938e..d84c7f4f9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictNeqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/StrictNeqTreeItem.java @@ -18,15 +18,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class StrictNeqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class StrictNeqTreeItem extends BinaryOpTreeItem implements LogicalOpItem { public StrictNeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); } @Override - public TreeItem invert() { + public GraphTargetItem invert() { return new StrictEqTreeItem(instruction, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/UnaryOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/UnaryOpTreeItem.java index e0846aa62..34079e1a1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/UnaryOpTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/UnaryOpTreeItem.java @@ -19,15 +19,17 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.HashMap; import java.util.List; public abstract class UnaryOpTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; public String operator; - public UnaryOpTreeItem(AVM2Instruction instruction, int precedence, TreeItem value, String operator) { + public UnaryOpTreeItem(AVM2Instruction instruction, int precedence, GraphTargetItem value, String operator) { super(instruction, precedence); this.value = value; this.operator = operator; @@ -35,7 +37,7 @@ public abstract class UnaryOpTreeItem extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - String s = value.toString(constants, localRegNames, fullyQualifiedNames); + String s = value.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)); if (value.precedence > precedence) { s = "(" + s + ")"; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java index 88f62ed7e..a33fdc303 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java @@ -22,12 +22,14 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph; import com.jpexs.decompiler.flash.abc.avm2.parser.ASM3Parser; import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Stack; import javax.swing.JOptionPane; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; @@ -71,7 +73,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } public void graph() { - AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex]); + AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, 0, new HashMap(), new Stack(), new HashMap(), new ArrayList()); (new GraphFrame(gr, "")).setVisible(true); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 374872aa9..164df862a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -21,11 +21,12 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.CodeStats; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.traits.Traits; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Stack; @@ -42,6 +43,16 @@ public class MethodBody implements Cloneable, Serializable { public ABCException exceptions[] = new ABCException[0]; public Traits traits = new Traits(); + public List getExceptionEntries() { + List ret = new ArrayList(); + for (ABCException e : exceptions) { + ret.add(code.adr2pos(e.start)); + ret.add(code.adr2pos(e.end)); + ret.add(code.adr2pos(e.target)); + } + return ret; + } + @Override public String toString() { String s = ""; @@ -88,7 +99,7 @@ public class MethodBody implements Cloneable, Serializable { return ret; } - public String toString(String path, boolean pcode, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], Stack scopeStack, boolean isStaticInitializer, boolean hilight, List fullyQualifiedNames, Traits initTraits) { + public String toString(String path, boolean pcode, boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], Stack scopeStack, boolean isStaticInitializer, boolean hilight, List fullyQualifiedNames, Traits initTraits) { String s = ""; if (!Main.DO_DECOMPILE) { s = "//NOT DECOMPILED"; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 1271df057..d712d49fc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -25,13 +25,13 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.FindPropertyStrict import com.jpexs.decompiler.flash.abc.avm2.instructions.other.GetLexIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.AsTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.ABCException; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.abc.types.NamespaceSet; import com.jpexs.decompiler.flash.abc.types.ScriptInfo; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.DoABCTag; @@ -380,7 +380,7 @@ public class TraitClass extends Trait { String bodyStr = ""; bodyIndex = abc.findBodyIndex(abc.class_info[class_info].cinit_index); if (bodyIndex != -1) { - bodyStr = abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", pcode, true, class_info, abc, abc.constants, abc.method_info, new Stack(), true, highlight, fullyQualifiedNames, abc.class_info[class_info].static_traits); + bodyStr = abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", pcode, true, class_info, abc, abc.constants, abc.method_info, new Stack(), true, highlight, fullyQualifiedNames, abc.class_info[class_info].static_traits); } if (Highlighting.stripHilights(bodyStr).equals("")) { toPrint = ABC.addTabs(bodyStr, 3); @@ -414,7 +414,7 @@ public class TraitClass extends Trait { bodyStr = ""; bodyIndex = abc.findBodyIndex(abc.instance_info[class_info].iinit_index); if (bodyIndex != -1) { - bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", pcode, false, class_info, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, abc.instance_info[class_info].instance_traits), 3); + bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", pcode, false, class_info, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, abc.instance_info[class_info].instance_traits), 3); constructorParams = abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants, abc.bodies[bodyIndex], abc, fullyQualifiedNames); } else { constructorParams = abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants, null, abc, fullyQualifiedNames); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java index 4fc9119c4..2f1db53d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.tags.DoABCTag; import java.util.List; @@ -50,7 +50,7 @@ public class TraitFunction extends Trait { String bodyStr = ""; int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { - bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + abc.constants.constant_multiname[name_index].getName(abc.constants, fullyQualifiedNames), pcode, isStatic, classIndex, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, null), 3); + bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + abc.constants.constant_multiname[name_index].getName(abc.constants, fullyQualifiedNames), pcode, isStatic, classIndex, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, null), 3); } return ABC.IDENT_STRING + ABC.IDENT_STRING + header + (abc.instance_info[classIndex].isInterface() ? ";" : " {\r\n" + bodyStr + "\r\n" + ABC.IDENT_STRING + ABC.IDENT_STRING + "}"); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java index 8304e9843..c338eb819 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; import com.jpexs.decompiler.flash.abc.types.MethodBody; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.tags.DoABCTag; import java.util.List; @@ -59,7 +59,7 @@ public class TraitMethodGetterSetter extends Trait { String bodyStr = ""; int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { - bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames), pcode, isStatic, classIndex, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, null), 3); + bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames), pcode, isStatic, classIndex, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, null), 3); } return ABC.IDENT_STRING + ABC.IDENT_STRING + header + ((classIndex != -1 && abc.instance_info[classIndex].isInterface()) ? ";" : " {\r\n" + bodyStr + "\r\n" + ABC.IDENT_STRING + ABC.IDENT_STRING + "}"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 2dc36f3cb..30042daf9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -29,6 +29,10 @@ import com.jpexs.decompiler.flash.action.swf7.ActionTry; import com.jpexs.decompiler.flash.action.treemodel.*; import com.jpexs.decompiler.flash.action.treemodel.clauses.*; import com.jpexs.decompiler.flash.action.treemodel.operations.NotTreeItem; +import com.jpexs.decompiler.flash.graph.GraphSource; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.IfItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; import java.io.ByteArrayOutputStream; @@ -40,7 +44,7 @@ import java.util.logging.Logger; /** * Represents one ACTIONRECORD, also has some static method to work with Actions */ -public class Action { +public class Action implements GraphSourceItem { public Action beforeInsert; public boolean ignored = false; @@ -406,7 +410,7 @@ public class Action { * @param output Output * @param regNames Register names */ - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { } /** @@ -415,8 +419,8 @@ public class Action { * @param stack Stack * @return long value */ - protected long popLong(Stack stack) { - TreeItem item = stack.pop(); + protected long popLong(Stack stack) { + GraphTargetItem item = stack.pop(); if (item instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) item).value instanceof Long) { return (long) (Long) ((DirectValueTreeItem) item).value; @@ -475,10 +479,11 @@ public class Action { * @param tree List of TreeItem * @return String */ - public static String treeToString(List tree) { + public static String treeToString(List tree) { String ret = ""; - for (TreeItem ti : tree) { - ret += ti.toString() + "\r\n"; + List localData = new ArrayList(); + for (GraphTargetItem ti : tree) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; } String parts[] = ret.split("\r\n"); ret = ""; @@ -584,7 +589,7 @@ public class Action { public static String actionsToSource(List actions, int version) { try { //List tree = actionsToTree(new HashMap(), actions, version); - List tree = actionsToTree(new HashMap(), actions, version); + List tree = actionsToTree(new HashMap(), actions, version); return treeToString(tree); @@ -602,12 +607,42 @@ public class Action { * @param version SWF version * @return List of treeItems */ - public static List actionsToTree(HashMap regNames, List actions, int version) { + public static List actionsToTree(HashMap regNames, List actions, int version) { //Stack stack = new Stack(); return ActionGraph.translateViaGraph(regNames, actions, version); //return actionsToTree(regNames, stack, actions, 0, actions.size() - 1, version); } + @Override + public void translate(List localData, Stack stack, List output) { + translate(stack, output, (HashMap) localData.get(0)); + } + + @Override + public boolean isJump() { + return false; + } + + @Override + public boolean isBranch() { + return false; + } + + @Override + public boolean isExit() { + return false; + } + + @Override + public long getOffset() { + return getAddress(); + } + + @Override + public List getBranches(GraphSource code) { + return new ArrayList(); + } + private static class Loop { public long loopContinue; @@ -630,15 +665,17 @@ public class Action { logger.fine(s); } - public static List actionsPartToTree(HashMap registerNames, Stack stack, List actions, int start, int end, int version) { + public static List actionsPartToTree(HashMap registerNames, Stack stack, List actions, int start, int end, int version) { if (start < actions.size() && (end > 0) && (start > 0)) { log("Entering " + start + "-" + end + (actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : "")); } - List output = new ArrayList(); + List localData = new ArrayList(); + localData.add(registerNames); + List output = new ArrayList(); int ip = start; boolean isWhile = false; boolean isForIn = false; - TreeItem inItem = null; + GraphTargetItem inItem = null; int loopStart = 0; loopip: while (ip <= end + 1) { @@ -678,34 +715,37 @@ public class Action { if (ip > end) { break; } + if (ip >= actions.size()) { + break; + } Action action = actions.get(ip); /*ActionJump && ActionIf removed*/ if ((action instanceof ActionEnumerate2) || (action instanceof ActionEnumerate)) { loopStart = ip + 1; isForIn = true; ip += 4; - action.translate(stack, output, registerNames); + action.translate(localData, stack, output); EnumerateTreeItem en = (EnumerateTreeItem) stack.peek(); inItem = en.object; continue; } else if (action instanceof ActionTry) { ActionTry atry = (ActionTry) action; - List tryCommands = ActionGraph.translateViaGraph(registerNames, atry.tryBody, version); + List tryCommands = ActionGraph.translateViaGraph(registerNames, atry.tryBody, version); TreeItem catchName; if (atry.catchInRegisterFlag) { catchName = new DirectValueTreeItem(atry, -1, new RegisterNumber(atry.catchRegister), new ArrayList()); } else { catchName = new DirectValueTreeItem(atry, -1, atry.catchName, new ArrayList()); } - List catchExceptions = new ArrayList(); + List catchExceptions = new ArrayList(); catchExceptions.add(catchName); - List> catchCommands = new ArrayList>(); + List> catchCommands = new ArrayList>(); catchCommands.add(ActionGraph.translateViaGraph(registerNames, atry.catchBody, version)); - List finallyCommands = ActionGraph.translateViaGraph(registerNames, atry.finallyBody, version); + List finallyCommands = ActionGraph.translateViaGraph(registerNames, atry.finallyBody, version); output.add(new TryTreeItem(tryCommands, catchExceptions, catchCommands, finallyCommands)); } else if (action instanceof ActionWith) { ActionWith awith = (ActionWith) action; - List withCommands = ActionGraph.translateViaGraph(registerNames, awith.actions, version); + List withCommands = ActionGraph.translateViaGraph(registerNames, awith.actions, version); output.add(new WithTreeItem(action, stack.pop(), withCommands)); } else if (action instanceof ActionDefineFunction) { FunctionTreeItem fti = new FunctionTreeItem(action, ((ActionDefineFunction) action).functionName, ((ActionDefineFunction) action).paramNames, ActionGraph.translateViaGraph(registerNames, ((ActionDefineFunction) action).code, version), ((ActionDefineFunction) action).constantPool, 1); @@ -770,11 +810,11 @@ public class Action { continue; }*/ else if (action instanceof ActionStoreRegister) { if ((ip + 1 <= end) && (actions.get(ip + 1) instanceof ActionPop)) { - action.translate(stack, output, registerNames); + action.translate(localData, stack, output); stack.pop(); ip++; } else { - action.translate(stack, output, registerNames); + action.translate(localData, stack, output); } } /*else if (action instanceof ActionStrictEquals) { if ((ip + 1 < actions.size()) && (actions.get(ip + 1) instanceof ActionIf)) { @@ -820,7 +860,7 @@ public class Action { } } */ else { try { - action.translate(stack, output, registerNames); + action.translate(localData, stack, output); } catch (EmptyStackException ese) { System.err.println("EMPTYSTACK==========================="); Logger.getLogger(Action.class.getName()).log(Level.SEVERE, null, ese); @@ -844,8 +884,8 @@ public class Action { return output; } - public static TreeItem getWithoutGlobal(TreeItem ti) { - TreeItem t = ti; + public static GraphTargetItem getWithoutGlobal(GraphTargetItem ti) { + GraphTargetItem t = ti; if (!(t instanceof GetMemberTreeItem)) { return ti; } @@ -872,19 +912,19 @@ public class Action { return ti; } - public static List checkClass(List output) { - List ret = new ArrayList(); + public static List checkClass(List output) { + List ret = new ArrayList(); List functions = new ArrayList(); List staticFunctions = new ArrayList(); - HashMap vars = new HashMap(); - HashMap staticVars = new HashMap(); - TreeItem className; - TreeItem extendsOp = null; - List implementsOp = new ArrayList(); + HashMap vars = new HashMap(); + HashMap staticVars = new HashMap(); + GraphTargetItem className; + GraphTargetItem extendsOp = null; + List implementsOp = new ArrayList(); boolean ok = true; - for (TreeItem t : output) { - if (t instanceof IfTreeItem) { - IfTreeItem it = (IfTreeItem) t; + for (GraphTargetItem t : output) { + if (t instanceof IfItem) { + IfItem it = (IfItem) t; if (it.expression instanceof NotTreeItem) { NotTreeItem nti = (NotTreeItem) it.expression; if (nti.value instanceof GetMemberTreeItem) { @@ -892,14 +932,14 @@ public class Action { if ((it.onTrue.size() == 1) && (it.onTrue.get(0) instanceof SetMemberTreeItem) && (((SetMemberTreeItem) it.onTrue.get(0)).value instanceof NewObjectTreeItem)) { //ignore } else { - List parts = it.onTrue; + List parts = it.onTrue; className = getWithoutGlobal((GetMemberTreeItem) nti.value); if (parts.size() >= 1) { if (parts.get(0) instanceof StoreRegisterTreeItem) { int classReg = ((StoreRegisterTreeItem) parts.get(0)).register.number; if ((parts.size() >= 2) && (parts.get(1) instanceof SetMemberTreeItem)) { - TreeItem ti1 = ((SetMemberTreeItem) parts.get(1)).value; - TreeItem ti2 = ((StoreRegisterTreeItem) parts.get(0)).value; + GraphTargetItem ti1 = ((SetMemberTreeItem) parts.get(1)).value; + GraphTargetItem ti2 = ((StoreRegisterTreeItem) parts.get(0)).value; if (ti1 == ti2) { if (((SetMemberTreeItem) parts.get(1)).value instanceof FunctionTreeItem) { ((FunctionTreeItem) ((SetMemberTreeItem) parts.get(1)).value).calculatedFunctionName = (className instanceof GetMemberTreeItem) ? ((GetMemberTreeItem) className).memberName : className; @@ -919,7 +959,7 @@ public class Action { if (parts.get(pos) instanceof StoreRegisterTreeItem) { int instanceReg = -1; if (((StoreRegisterTreeItem) parts.get(pos)).value instanceof GetMemberTreeItem) { - TreeItem obj = ((GetMemberTreeItem) ((StoreRegisterTreeItem) parts.get(pos)).value).object; + GraphTargetItem obj = ((GetMemberTreeItem) ((StoreRegisterTreeItem) parts.get(pos)).value).object; if (obj instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) obj).value instanceof RegisterNumber) { if (((RegisterNumber) ((DirectValueTreeItem) obj).value).number == classReg) { @@ -1006,7 +1046,7 @@ public class Action { pos++; } if (ok) { - List output2 = new ArrayList(); + List output2 = new ArrayList(); output2.add(new ClassTreeItem(className, extendsOp, implementsOp, functions, vars, staticFunctions, staticVars)); return output2; } @@ -1037,7 +1077,7 @@ public class Action { break; } } - List output2 = new ArrayList(); + List output2 = new ArrayList(); output2.add(new InterfaceTreeItem(sm.objectName, implementsOp)); return output2; } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 5993fb2cb..7b06acf3a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -17,30 +17,17 @@ package com.jpexs.decompiler.flash.action; import com.jpexs.decompiler.flash.action.swf4.ActionIf; -import com.jpexs.decompiler.flash.action.swf4.ActionJump; import com.jpexs.decompiler.flash.action.swf4.Null; -import com.jpexs.decompiler.flash.action.swf5.ActionReturn; -import com.jpexs.decompiler.flash.action.swf7.ActionThrow; -import com.jpexs.decompiler.flash.action.treemodel.BreakTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.DoWhileTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.ForTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.IfTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.SwitchTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.TernarOpTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.clauses.WhileTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.operations.AndTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.operations.LogicalOp; -import com.jpexs.decompiler.flash.action.treemodel.operations.NotTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.operations.OrTreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StrictEqTreeItem; +import com.jpexs.decompiler.flash.graph.BreakItem; +import com.jpexs.decompiler.flash.graph.ContinueItem; import com.jpexs.decompiler.flash.graph.Graph; import com.jpexs.decompiler.flash.graph.GraphPart; -import com.jpexs.decompiler.flash.graph.GraphPartMulti; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.graph.Loop; +import com.jpexs.decompiler.flash.graph.SwitchItem; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -55,699 +42,842 @@ import java.util.Stack; public class ActionGraph extends Graph { private List code; - private int version; + //private int version; - public ActionGraph(List code, int version) { - this.version = version; + public ActionGraph(List code, HashMap registerNames, int version) { + super(new ActionGraphSource(code, version, registerNames), new ArrayList()); + //this.version = version; this.code = code; - heads = makeGraph(code, new ArrayList()); - for (GraphPart head : heads) { - fixGraph(head); - makeMulti(head, new ArrayList()); - } - + /*heads = makeGraph(code, new ArrayList()); + for (GraphPart head : heads) { + fixGraph(head); + makeMulti(head, new ArrayList()); + }*/ } - public static List translateViaGraph(HashMap registerNames, List code, int version) { - ActionGraph g = new ActionGraph(code, version); + public static List translateViaGraph(HashMap registerNames, List code, int version) { + ActionGraph g = new ActionGraph(code, registerNames, version); List allParts = new ArrayList(); for (GraphPart head : g.heads) { populateParts(head, allParts); } - return Action.checkClass(g.printGraph(registerNames, new Stack(), allParts, null, g.heads.get(0), null, new ArrayList(), new HashMap>())); + List localData = new ArrayList(); + localData.add(registerNames); + List output = g.printGraph(localData, new Stack(), allParts, null, g.heads.get(0), null, new ArrayList(), new HashMap>()); + return Action.checkClass(output); } - private TreeItem translatePartGetStack(GraphPart part, Stack stack, HashMap registerNames) { - stack = (Stack) stack.clone(); - translatePart(part, stack, registerNames); - return stack.pop(); - } + protected List check(List localData, List allParts, Stack stack, GraphPart part, GraphPart stopPart, List loops, List output, HashMap> forFinalCommands) { + List ret = null; + if (stack.peek() instanceof StrictEqTreeItem) { - private List translatePart(GraphPart part, Stack stack, HashMap registerNames) { - List sub = part.getSubParts(); - List ret = new ArrayList(); - int end = 0; - for (GraphPart p : sub) { - if (p.end == -1) { - p.end = code.size() - 1; - } - if (p.start == code.size()) { - continue; - } else if (p.end == code.size()) { - p.end--; - } - end = p.end; - int start = p.start; - if (code.get(end) instanceof ActionJump) { - end--; - } else if (code.get(end) instanceof ActionIf) { - end--; - } - ret.addAll(Action.actionsPartToTree(registerNames, stack, code, start, end, version)); - } - return ret; - } - - private TreeItem checkLoop(GraphPart part, GraphPart stopPart, List loops) { - if (part == stopPart) { - return null; - } - for (Loop l : loops) { - if (l.loopContinue == part) { - return (new ContinueTreeItem(null, l.loopBreak == null ? -1 : l.loopBreak.start)); - } - if (l.loopBreak == part) { - return (new BreakTreeItem(null, part.start)); - } - } - return null; - } - private boolean doDecompile = true; - - private List printGraph(HashMap registerNames, Stack stack, List allParts, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap> forFinalCommands) { - List ret = new ArrayList(); - boolean debugMode = false; - if (part.start >= code.size()) { - return ret; - } - - if (!doDecompile) { - // ret.add(new CommentTreeItem(null, "not decompiled")); - return ret; - } - - if (debugMode) { - System.err.println("PART " + part); - } - - if (part == stopPart) { - return ret; - } - if (part.ignored) { - return ret; - } - List fqn = new ArrayList(); - HashMap lrn = new HashMap(); - List output = new ArrayList(); - boolean isSwitch = false; - List parts = new ArrayList(); - if (part instanceof GraphPartMulti) { - parts = ((GraphPartMulti) part).parts; - } else { - parts.add(part); - } - boolean isIf = false; - int end = part.end; - if (end == -1) { - end = code.size() - 1; - } - if (end == code.size()) { - end--; - } - output.addAll(translatePart(part, stack, registerNames)); - if (end > -1) { - if (code.get(end) instanceof ActionJump) { - end--; - } else if (code.get(end) instanceof ActionIf) { - end--; - isIf = true; - } - } - if (isIf) { - Action ins = code.get(end + 1); - if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotTreeItem) && (((NotTreeItem) stack.get(stack.size() - 1)).value == stack.get(stack.size() - 2))) { - ret.addAll(output); - printGraph(registerNames, stack, allParts, parent, part.nextParts.get(1), part.nextParts.get(0), loops, forFinalCommands); - TreeItem second = stack.pop(); - TreeItem first = stack.pop(); - stack.push(new AndTreeItem(ins, first, second)); - ret.addAll(printGraph(registerNames, stack, allParts, parent, part.nextParts.get(0), stopPart, loops, forFinalCommands)); - return ret; - } else if ((stack.size() >= 2) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { - ret.addAll(output); - printGraph(registerNames, stack, allParts, parent, part.nextParts.get(1), part.nextParts.get(0), loops, forFinalCommands); - TreeItem second = stack.pop(); - TreeItem first = stack.pop(); - stack.push(new OrTreeItem(ins, first, second)); - ret.addAll(printGraph(registerNames, stack, allParts, parent, part.nextParts.get(0), stopPart, loops, forFinalCommands)); - return ret; - } else if (stack.peek() instanceof StrictEqTreeItem) { - - TreeItem switchedObject = null; - if (!output.isEmpty()) { - if (output.get(output.size() - 1) instanceof StoreRegisterTreeItem) { - switchedObject = ((StoreRegisterTreeItem) output.get(output.size() - 1)).value; - } + GraphTargetItem switchedObject = null; + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof StoreRegisterTreeItem) { + switchedObject = ((StoreRegisterTreeItem) output.get(output.size() - 1)).value; } - if (switchedObject == null) { - switchedObject = new DirectValueTreeItem(null, -1, new Null(), null); - } - HashMap caseValuesMap = new HashMap(); + } + if (switchedObject == null) { + switchedObject = new DirectValueTreeItem(null, -1, new Null(), null); + } + HashMap caseValuesMap = new HashMap(); - int pos = 0; - StrictEqTreeItem set = (StrictEqTreeItem) stack.pop(); - caseValuesMap.put(pos, set.rightSide); + int pos = 0; + StrictEqTreeItem set = (StrictEqTreeItem) stack.pop(); + caseValuesMap.put(pos, set.rightSide); - //GraphPart switchLoc = part.nextParts.get(1).nextParts.get(0); - List caseBodyParts = new ArrayList(); + //GraphPart switchLoc = part.nextParts.get(1).nextParts.get(0); + List caseBodyParts = new ArrayList(); + caseBodyParts.add(part.nextParts.get(0)); + GraphTargetItem top = null; + int cnt = 1; + while (part.nextParts.size() > 1 + && part.nextParts.get(1).getHeight() > 1 + && code.get(part.nextParts.get(1).end) instanceof ActionIf + && ((top = translatePartGetStack(localData, part.nextParts.get(1), stack)) instanceof StrictEqTreeItem)) { + cnt++; + part = part.nextParts.get(1); + pos++; caseBodyParts.add(part.nextParts.get(0)); - TreeItem top = null; - int cnt = 1; - while (part.nextParts.size() > 1 - && part.nextParts.get(1).getHeight() > 1 - && code.get(part.nextParts.get(1).end) instanceof ActionIf - && ((top = translatePartGetStack(part.nextParts.get(1), stack, registerNames)) instanceof StrictEqTreeItem)) { - cnt++; - part = part.nextParts.get(1); - pos++; - caseBodyParts.add(part.nextParts.get(0)); - /*List subparts=part.getSubParts(); - for(GraphPart p:subparts){ - Action.actionsPartToTree(registerNames, stack, code, p.start, p.end - 1, version); - }*/ - set = (StrictEqTreeItem) top; - caseValuesMap.put(pos, set.rightSide); + + set = (StrictEqTreeItem) top; + caseValuesMap.put(pos, set.rightSide); + } + if (cnt == 1) { + stack.push(set); + } else { + part = part.nextParts.get(1); + + GraphPart defaultPart = part; + //caseBodyParts.add(defaultPart); + + + + List defaultAndLastPart = new ArrayList(); + defaultAndLastPart.add(defaultPart); + defaultAndLastPart.add(caseBodyParts.get(caseBodyParts.size() - 1)); + + GraphPart defaultPart2 = getCommonPart(defaultAndLastPart); + + List defaultCommands = new ArrayList(); + + defaultCommands = printGraph(localData, stack, allParts, null, defaultPart, defaultPart2, loops, forFinalCommands); + + + List loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } } - if (cnt == 1) { - stack.push(set); - } else { - part = part.nextParts.get(1); - GraphPart defaultPart = part; - //caseBodyParts.add(defaultPart); - - - - List defaultAndLastPart = new ArrayList(); - defaultAndLastPart.add(defaultPart); - defaultAndLastPart.add(caseBodyParts.get(caseBodyParts.size() - 1)); - - GraphPart defaultPart2 = getCommonPart(defaultAndLastPart); - - List defaultCommands = new ArrayList(); - - defaultCommands = printGraph(registerNames, stack, allParts, null, defaultPart, defaultPart2, loops, forFinalCommands); - - - List loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } - - List breakParts = new ArrayList(); - for (int g = 0; g < caseBodyParts.size(); g++) { - if (g < caseBodyParts.size() - 1) { - if (caseBodyParts.get(g).leadsTo(caseBodyParts.get(g + 1), loopContinues)) { - continue; - } - } - GraphPart nsp = caseBodyParts.get(g).getNextSuperPartPath(loopContinues); - if (nsp != null) { - breakParts.add(nsp); - } - } - /*GraphPart nspd=defaultPart.getNextSuperPartPath(loopContinues); - if(nspd!=null){ - breakParts.add(nspd); - }*/ - - Collections.sort(breakParts, new Comparator() { - @Override - public int compare(GraphPart o1, GraphPart o2) { - return o2.path.length() - o1.path.length(); - } - }); - - GraphPart breakPart = breakParts.isEmpty() ? null : breakParts.get(0); - if ((defaultPart2 != breakPart) && (defaultCommands.isEmpty())) { - defaultPart = defaultPart2; - } - - - List caseValues = new ArrayList(); - for (int i = 0; i < caseBodyParts.size(); i++) { - if (caseValuesMap.containsKey(i)) { - caseValues.add(caseValuesMap.get(i)); - } else { + List breakParts = new ArrayList(); + for (int g = 0; g < caseBodyParts.size(); g++) { + if (g < caseBodyParts.size() - 1) { + if (caseBodyParts.get(g).leadsTo(caseBodyParts.get(g + 1), loopContinues)) { continue; } } - - List> caseCommands = new ArrayList>(); - GraphPart next = null; - - - - next = breakPart; - - TreeItem ti = checkLoop(next, stopPart, loops); - loops.add(new Loop(null, next)); - //switchLoc.getNextPartPath(new ArrayList()); - List valuesMapping = new ArrayList(); - List caseBodies = new ArrayList(); - for (int i = 0; i < caseValues.size(); i++) { - GraphPart cur = caseBodyParts.get(i); - if (!caseBodies.contains(cur)) { - caseBodies.add(cur); - } - valuesMapping.add(caseBodies.indexOf(cur)); + GraphPart nsp = caseBodyParts.get(g).getNextSuperPartPath(loopContinues); + if (nsp != null) { + breakParts.add(nsp); } - - - - - if (defaultPart == breakPart) { - defaultPart = null; - } - if ((defaultPart != null) && (defaultCommands.isEmpty())) { - defaultCommands = printGraph(registerNames, stack, allParts, null, defaultPart, next, loops, forFinalCommands); - } - - List ignored = new ArrayList(); - for (Loop l : loops) { - ignored.add(l.loopContinue); - } - - for (int i = 0; i < caseBodies.size(); i++) { - List cc = new ArrayList(); - GraphPart nextCase = null; - nextCase = next; - if (next != null) { - if (i < caseBodies.size() - 1) { - if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { - cc.add(new BreakTreeItem(null, next.start)); - } else { - nextCase = caseBodies.get(i + 1); - } - } else if (!defaultCommands.isEmpty()) { - if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { - cc.add(new BreakTreeItem(null, next.start)); - } else { - nextCase = defaultPart; - } - } - } - cc.addAll(0, printGraph(registerNames, stack, allParts, null, caseBodies.get(i), nextCase, loops, forFinalCommands)); - if (cc.size() >= 2) { - if (cc.get(cc.size() - 1) instanceof BreakTreeItem) { - if ((cc.get(cc.size() - 2) instanceof ContinueTreeItem) || (cc.get(cc.size() - 2) instanceof BreakTreeItem)) { - cc.remove(cc.size() - 1); - } - } - } - caseCommands.add(cc); - } - - SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); - ret.add(sti); - - if (next != null) { - if (ti != null) { - ret.add(ti); - } else { - ret.addAll(printGraph(registerNames, stack, allParts, null, next, stopPart, loops, forFinalCommands)); - } - } - return ret; } - } else { - /*ins.translate*/ - } - //((IfTypeIns)ins.definition).translateInverted(new HashMap(), co.stack, ins); - } + Collections.sort(breakParts, new Comparator() { + @Override + public int compare(GraphPart o1, GraphPart o2) { + return o2.path.length() - o1.path.length(); + } + }); - int ip = part.start; - List loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } - boolean loop = false; - boolean reversed = false; - if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { - loop = true; - } else if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { - loop = true; - reversed = true; - } - if (((part.nextParts.size() == 2) || ((part.nextParts.size() == 1) && loop)) && (!isSwitch)) { + GraphPart breakPart = breakParts.isEmpty() ? null : breakParts.get(0); + if ((defaultPart2 != breakPart) && (defaultCommands.isEmpty())) { + defaultPart = defaultPart2; + } - boolean doWhile = loop; - if (loop && output.isEmpty()) { - doWhile = false; - } - Loop currentLoop = new Loop(part, null); - if (loop) { + + List caseValues = new ArrayList(); + for (int i = 0; i < caseBodyParts.size(); i++) { + if (caseValuesMap.containsKey(i)) { + caseValues.add(caseValuesMap.get(i)); + } else { + continue; + } + } + + List> caseCommands = new ArrayList>(); + GraphPart next = null; + + + + next = breakPart; + + GraphTargetItem ti = checkLoop(next, stopPart, loops); + Loop currentLoop = new Loop(null, next); loops.add(currentLoop); - } - - - - loopContinues = new ArrayList(); - for (Loop l : loops) { - if (l.loopContinue != null) { - loopContinues.add(l.loopContinue); - } - } - - if (part.nextParts.size() > 1) { - currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); - } - - forFinalCommands.put(currentLoop, new ArrayList()); - - int breakIp = -1; - if (currentLoop.loopBreak != null) { - breakIp = currentLoop.loopBreak.start; - } - TreeItem expr = null; - if ((code.get(part.end) instanceof ActionJump) || (!(code.get(part.end) instanceof ActionIf))) { - expr = new DirectValueTreeItem(null, -1, (Boolean) true, new ArrayList()); - } else { - if (stack.isEmpty()) { - } - expr = stack.pop(); - } - if (doWhile) { - ret.add(new DoWhileTreeItem(null, breakIp, part.start, output, expr)); - } else { - ret.addAll(output); - } - - GraphPart next = part.getNextPartPath(loopContinues); - - if (loop && (!doWhile)) { - - if (reversed && (expr instanceof LogicalOp)) { - expr = ((LogicalOp) expr).invert(); - } - List loopBody = null; - List finalCommands = null; - GraphPart finalPart = null; - loopBody = printGraph(registerNames, stack, allParts, part, part.nextParts.get(reversed ? 1 : 0), stopPart, loops, forFinalCommands); - - finalCommands = forFinalCommands.get(currentLoop); - if (!finalCommands.isEmpty()) { - ret.add(new ForTreeItem(null, breakIp, currentLoop.loopContinue.start, new ArrayList(), expr, finalCommands, loopBody)); - } /*else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextValueTreeItem)) { - TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); - loopBody.remove(0); - ret.add(new ForEachInTreeItem(null, breakIp, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); - } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextNameTreeItem)) { - TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); - loopBody.remove(0); - ret.add(new ForInTreeItem(null, breakIp, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); - }*/ else { - ret.add(new WhileTreeItem(null, breakIp, part.start, expr, loopBody)); - } - } else if (!loop) { - if (expr instanceof LogicalOp) { - expr = ((LogicalOp) expr).invert(); - } else { - expr = new NotTreeItem(null, expr); - } - - int stackSizeBefore = stack.size(); - Stack trueStack = (Stack) stack.clone(); - Stack falseStack = (Stack) stack.clone(); - TreeItem lopTrue = checkLoop(part.nextParts.get(1), stopPart, loops); - TreeItem lopFalse = null; - if (next != part.nextParts.get(0)) { - lopFalse = checkLoop(part.nextParts.get(0), stopPart, loops); - } - List onTrue = new ArrayList(); - if (lopTrue != null) { - onTrue.add(lopTrue); - } else { - if (debugMode) { - System.err.println("ONTRUE: (inside " + part + ")"); - } - onTrue = printGraph(registerNames, trueStack, allParts, part, part.nextParts.get(1), next == null ? stopPart : next, loops, forFinalCommands); - if (debugMode) { - System.err.println("/ONTRUE (inside " + part + ")"); - } - } - List onFalse = new ArrayList(); - if (lopFalse != null) { - onFalse.add(lopFalse); - } else { - if (debugMode) { - System.err.println("ONFALSE: (inside " + part + ")"); - } - onFalse = (((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) ? new ArrayList() : printGraph(registerNames, falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands)); - if (debugMode) { - System.err.println("/ONFALSE (inside " + part + ")"); + //switchLoc.getNextPartPath(new ArrayList()); + List valuesMapping = new ArrayList(); + List caseBodies = new ArrayList(); + for (int i = 0; i < caseValues.size(); i++) { + GraphPart cur = caseBodyParts.get(i); + if (!caseBodies.contains(cur)) { + caseBodies.add(cur); } + valuesMapping.add(caseBodies.indexOf(cur)); } - if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { - stack.push(new TernarOpTreeItem(null, expr, trueStack.pop(), falseStack.pop())); - } else { - ret.add(new IfTreeItem(null, expr, onTrue, onFalse)); - //Same continues in onTrue and onFalse gets continue on parent level - if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { - if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { - if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { - if (((ContinueTreeItem) onTrue.get(onTrue.size() - 1)).loopPos == ((ContinueTreeItem) onFalse.get(onFalse.size() - 1)).loopPos) { - onTrue.remove(onTrue.size() - 1); - ret.add(onFalse.remove(onFalse.size() - 1)); - } + + + if (defaultPart == breakPart) { + defaultPart = null; + } + if ((defaultPart != null) && (defaultCommands.isEmpty())) { + defaultCommands = printGraph(localData, stack, allParts, null, defaultPart, next, loops, forFinalCommands); + } + + List ignored = new ArrayList(); + for (Loop l : loops) { + ignored.add(l.loopContinue); + } + + for (int i = 0; i < caseBodies.size(); i++) { + List cc = new ArrayList(); + GraphPart nextCase = null; + nextCase = next; + if (next != null) { + if (i < caseBodies.size() - 1) { + if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { + cc.add(new BreakItem(null, currentLoop.id)); + } else { + nextCase = caseBodies.get(i + 1); + } + } else if (!defaultCommands.isEmpty()) { + if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { + cc.add(new BreakItem(null, currentLoop.id)); + } else { + nextCase = defaultPart; } } } - } - } - if (loop && (part.nextParts.size() > 1)) { - loops.remove(currentLoop); //remove loop so no break shows up - ret.addAll(printGraph(registerNames, stack, allParts, part, part.nextParts.get(reversed ? 0 : 1), stopPart, loops, forFinalCommands)); - } - - if (next != null) { - TreeItem ti = checkLoop(next, stopPart, loops); - if (ti != null) { - ret.add(ti); - } else { - if (debugMode) { - System.err.println("NEXT: (inside " + part + ")"); - } - ret.addAll(printGraph(registerNames, stack, allParts, part, next, stopPart, loops, forFinalCommands)); - if (debugMode) { - System.err.println("/NEXT: (inside " + part + ")"); - } - } - - } - } else { - ret.addAll(output); - } - onepart: - if (part.nextParts.size() == 1 && (!loop)) { - - - GraphPart p = part.nextParts.get(0); - TreeItem lop = checkLoop(p, stopPart, loops); - if (lop == null) { - if (p.path.length() == part.path.length()) { - ret.addAll(printGraph(registerNames, stack, allParts, part, p, stopPart, loops, forFinalCommands)); - } else { - if ((p != stopPart) && (p.refs.size() > 1)) { - List nextList = new ArrayList(); - populateParts(p, nextList); - Loop nearestLoop = null; - loopn: - for (GraphPart n : nextList) { - for (Loop l : loops) { - if (l.loopContinue == n) { - nearestLoop = l; - break loopn; - } + cc.addAll(0, printGraph(localData, stack, allParts, null, caseBodies.get(i), nextCase, loops, forFinalCommands)); + if (cc.size() >= 2) { + if (cc.get(cc.size() - 1) instanceof BreakItem) { + if ((cc.get(cc.size() - 2) instanceof ContinueItem) || (cc.get(cc.size() - 2) instanceof BreakItem)) { + cc.remove(cc.size() - 1); } } - if ((nearestLoop != null) && (nearestLoop.loopBreak != null)) { - List finalCommands = printGraph(registerNames, stack, allParts, part, p, nearestLoop.loopContinue, loops, forFinalCommands); - nearestLoop.loopContinue = p; - forFinalCommands.put(nearestLoop, finalCommands); - ContinueTreeItem cti = new ContinueTreeItem(null, nearestLoop.loopBreak.start); - ret.add(cti); - } + } + caseCommands.add(cc); + } + ret = new ArrayList(); + SwitchItem sti = new SwitchItem(null, currentLoop, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); + ret.add(sti); + + if (next != null) { + if (ti != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(localData, stack, allParts, null, next, stopPart, loops, forFinalCommands)); } } - } else { - ret.add(lop); } } return ret; } - private List posCache; + /* + private TreeItem translatePartGetStack(GraphPart part, Stack stack, HashMap registerNames) { + stack = (Stack) stack.clone(); + translatePart(part, stack, registerNames); + return stack.pop(); + } - private void buildCache() { - posCache = new ArrayList(); - int pos = 0; - for (int i = 0; i < code.size(); i++) { - posCache.add(pos); - pos += code.get(i).getBytes(version).length; - } - posCache.add(pos); - } + private List translatePart(GraphPart part, Stack stack, HashMap registerNames) { + List sub = part.getSubParts(); + List ret = new ArrayList(); + int end = 0; + for (GraphPart p : sub) { + if (p.end == -1) { + p.end = code.size() - 1; + } + if (p.start == code.size()) { + continue; + } else if (p.end == code.size()) { + p.end--; + } + end = p.end; + int start = p.start; + if (code.get(end) instanceof ActionJump) { + end--; + } else if (code.get(end) instanceof ActionIf) { + end--; + } + ret.addAll(Action.actionsPartToTree(registerNames, stack, code, start, end, version)); + } + return ret; + } - private int pos2adr(int pos) { - if (posCache == null) { - buildCache(); - } - return posCache.get(pos); - } + private TreeItem checkLoop(GraphPart part, GraphPart stopPart, List loops) { + if (part == stopPart) { + return null; + } + for (Loop l : loops) { + if (l.loopContinue == part) { + return (new ContinueTreeItem(null, l.loopBreak == null ? -1 : l.loopBreak.start)); + } + if (l.loopBreak == part) { + return (new BreakTreeItem(null, part.start)); + } + } + return null; + } + private boolean doDecompile = true; - private int adr2pos(int adr) { - if (posCache == null) { - buildCache(); - } - return posCache.indexOf(adr); - } + private List printGraph(HashMap registerNames, Stack stack, List allParts, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap> forFinalCommands) { + List ret = new ArrayList(); + boolean debugMode = false; + if (part.start >= code.size()) { + return ret; + } - private void visitCode(int ip, int lastIp, HashMap> refs) { - while (ip < code.size()) { - refs.get(ip).add(lastIp); - lastIp = ip; - if (refs.get(ip).size() > 1) { - break; - } - Action ins = code.get(ip); - if (ins instanceof ActionThrow) { - break; - } - if (ins instanceof ActionReturn) { - break; - } + if (!doDecompile) { + // ret.add(new CommentTreeItem(null, "not decompiled")); + return ret; + } - /*if (ins.definition instanceof LookupSwitchIns) { - try { - for (int i = 2; i < ins.operands.length; i++) { - visitCode(adr2pos(pos2adr(ip) + ins.operands[i]), ip, refs); - } - ip = adr2pos(pos2adr(ip) + ins.operands[0]); - continue; - } catch (ConvertException ex) { - } - }*/ - if (ins instanceof ActionJump) { - ip = adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionJump) ins).offset); - continue; - } else if (ins instanceof ActionIf) { - visitCode(adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionIf) ins).offset), ip, refs); - } - ip++; - }; - } + if (debugMode) { + System.err.println("PART " + part); + } - public HashMap> visitCode() { - HashMap> refs = new HashMap>(); - for (int i = 0; i < code.size(); i++) { - refs.put(i, new ArrayList()); - } - visitCode(0, 0, refs); - return refs; - } + if (part == stopPart) { + return ret; + } + if (part.ignored) { + return ret; + } + List fqn = new ArrayList(); + HashMap lrn = new HashMap(); + List output = new ArrayList(); + boolean isSwitch = false; + List parts = new ArrayList(); + if (part instanceof GraphPartMulti) { + parts = ((GraphPartMulti) part).parts; + } else { + parts.add(part); + } + boolean isIf = false; + int end = part.end; + if (end == -1) { + end = code.size() - 1; + } + if (end == code.size()) { + end--; + } + output.addAll(translatePart(part, stack, registerNames)); + if (end > -1) { + if (code.get(end) instanceof ActionJump) { + end--; + } else if (code.get(end) instanceof ActionIf) { + end--; + isIf = true; + } + } + if (isIf) { + Action ins = code.get(end + 1); + if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotTreeItem) && (((NotTreeItem) stack.get(stack.size() - 1)).value == stack.get(stack.size() - 2))) { + ret.addAll(output); + printGraph(registerNames, stack, allParts, parent, part.nextParts.get(1), part.nextParts.get(0), loops, forFinalCommands); + TreeItem second = stack.pop(); + TreeItem first = stack.pop(); + stack.push(new AndTreeItem(ins, first, second)); + ret.addAll(printGraph(registerNames, stack, allParts, parent, part.nextParts.get(0), stopPart, loops, forFinalCommands)); + return ret; + } else if ((stack.size() >= 2) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { + ret.addAll(output); + printGraph(registerNames, stack, allParts, parent, part.nextParts.get(1), part.nextParts.get(0), loops, forFinalCommands); + TreeItem second = stack.pop(); + TreeItem first = stack.pop(); + stack.push(new OrTreeItem(ins, first, second)); + ret.addAll(printGraph(registerNames, stack, allParts, parent, part.nextParts.get(0), stopPart, loops, forFinalCommands)); + return ret; + } else if (stack.peek() instanceof StrictEqTreeItem) { - private List makeGraph(List actions, List allBlocks) { - HashMap> refs = visitCode(); - List ret = new ArrayList(); - boolean visited[] = new boolean[code.size()]; - ret.add(makeGraph(null, "0", code, 0, 0, allBlocks, refs, visited)); - return ret; - } + TreeItem switchedObject = null; + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof StoreRegisterTreeItem) { + switchedObject = ((StoreRegisterTreeItem) output.get(output.size() - 1)).value; + } + } + if (switchedObject == null) { + switchedObject = new DirectValueTreeItem(null, -1, new Null(), null); + } + HashMap caseValuesMap = new HashMap(); - private GraphPart makeGraph(GraphPart parent, String path, List code, int startip, int lastIp, List allBlocks, HashMap> refs, boolean visited2[]) { + int pos = 0; + StrictEqTreeItem set = (StrictEqTreeItem) stack.pop(); + caseValuesMap.put(pos, set.rightSide); - int ip = startip; - for (GraphPart p : allBlocks) { - if (p.start == ip) { - p.refs.add(parent); - return p; - } - } - GraphPart g; - GraphPart ret = new GraphPart(ip, -1); - ret.path = path; - GraphPart part = ret; - while (ip < code.size()) { - if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) { - part.end = lastIp; - GraphPart found = null; - for (GraphPart p : allBlocks) { - if (p.start == ip) { - found = p; - break; - } - } + //GraphPart switchLoc = part.nextParts.get(1).nextParts.get(0); + List caseBodyParts = new ArrayList(); + caseBodyParts.add(part.nextParts.get(0)); + TreeItem top = null; + int cnt = 1; + while (part.nextParts.size() > 1 + && part.nextParts.get(1).getHeight() > 1 + && code.get(part.nextParts.get(1).end) instanceof ActionIf + && ((top = translatePartGetStack(part.nextParts.get(1), stack, registerNames)) instanceof StrictEqTreeItem)) { + cnt++; + part = part.nextParts.get(1); + pos++; + caseBodyParts.add(part.nextParts.get(0)); + + set = (StrictEqTreeItem) top; + caseValuesMap.put(pos, set.rightSide); + } + if (cnt == 1) { + stack.push(set); + } else { + part = part.nextParts.get(1); - allBlocks.add(part); + GraphPart defaultPart = part; + //caseBodyParts.add(defaultPart); - if (found != null) { - part.nextParts.add(found); - found.refs.add(part); - break; - } else { - GraphPart gp = new GraphPart(ip, -1); - gp.path = path; - part.nextParts.add(gp); - gp.refs.add(part); - part = gp; - } - } - lastIp = ip; - Action ins = code.get(ip); - if ((ins instanceof ActionThrow) || (ins instanceof ActionReturn)) { - part.end = ip; - allBlocks.add(part); - break; - } - /*if (ins.definition instanceof LookupSwitchIns) { - part.end = ip; - allBlocks.add(part); - try { - part.nextParts.add(g = makeGraph(part, path + "0", code, code.adr2pos(code.pos2adr(ip) + ins.operands[0]), ip, allBlocks, refs, visited2)); - g.refs.add(part); - for (int i = 2; i < ins.operands.length; i++) { - part.nextParts.add(g = makeGraph(part, path + (i - 1), code, code.adr2pos(code.pos2adr(ip) + ins.operands[i]), ip, allBlocks, refs, visited2)); - g.refs.add(part); - } - break; - } catch (ConvertException ex) { - } - }*/ - if (ins instanceof ActionJump) { - part.end = ip; - allBlocks.add(part); - int newip = adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionJump) ins).offset); - part.nextParts.add(g = makeGraph(part, path, code, newip, lastIp, allBlocks, refs, visited2)); - g.refs.add(part); - break; - } else if (ins instanceof ActionIf) { - part.end = ip; - allBlocks.add(part); - part.nextParts.add(g = makeGraph(part, path + "0", code, adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionIf) ins).offset), ip, allBlocks, refs, visited2)); - g.refs.add(part); - part.nextParts.add(g = makeGraph(part, path + "1", code, ip + 1, ip, allBlocks, refs, visited2)); - g.refs.add(part); - break; - } - ip++; - }; - if (ip == code.size()) { - allBlocks.add(part); - if (part.start == ip) { - part.end = ip; - } else { - part.end = code.size() - 1; - part.nextParts.add(makeGraph(part, path, code, ip, ip, allBlocks, refs, visited2)); - } - } - return ret; - } + List defaultAndLastPart = new ArrayList(); + defaultAndLastPart.add(defaultPart); + defaultAndLastPart.add(caseBodyParts.get(caseBodyParts.size() - 1)); + + GraphPart defaultPart2 = getCommonPart(defaultAndLastPart); + + List defaultCommands = new ArrayList(); + + defaultCommands = printGraph(registerNames, stack, allParts, null, defaultPart, defaultPart2, loops, forFinalCommands); + + + List loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + + List breakParts = new ArrayList(); + for (int g = 0; g < caseBodyParts.size(); g++) { + if (g < caseBodyParts.size() - 1) { + if (caseBodyParts.get(g).leadsTo(caseBodyParts.get(g + 1), loopContinues)) { + continue; + } + } + GraphPart nsp = caseBodyParts.get(g).getNextSuperPartPath(loopContinues); + if (nsp != null) { + breakParts.add(nsp); + } + } + Collections.sort(breakParts, new Comparator() { + @Override + public int compare(GraphPart o1, GraphPart o2) { + return o2.path.length() - o1.path.length(); + } + }); + + GraphPart breakPart = breakParts.isEmpty() ? null : breakParts.get(0); + if ((defaultPart2 != breakPart) && (defaultCommands.isEmpty())) { + defaultPart = defaultPart2; + } + + + List caseValues = new ArrayList(); + for (int i = 0; i < caseBodyParts.size(); i++) { + if (caseValuesMap.containsKey(i)) { + caseValues.add(caseValuesMap.get(i)); + } else { + continue; + } + } + + List> caseCommands = new ArrayList>(); + GraphPart next = null; + + + + next = breakPart; + + TreeItem ti = checkLoop(next, stopPart, loops); + loops.add(new Loop(null, next)); + //switchLoc.getNextPartPath(new ArrayList()); + List valuesMapping = new ArrayList(); + List caseBodies = new ArrayList(); + for (int i = 0; i < caseValues.size(); i++) { + GraphPart cur = caseBodyParts.get(i); + if (!caseBodies.contains(cur)) { + caseBodies.add(cur); + } + valuesMapping.add(caseBodies.indexOf(cur)); + } + + + + + if (defaultPart == breakPart) { + defaultPart = null; + } + if ((defaultPart != null) && (defaultCommands.isEmpty())) { + defaultCommands = printGraph(registerNames, stack, allParts, null, defaultPart, next, loops, forFinalCommands); + } + + List ignored = new ArrayList(); + for (Loop l : loops) { + ignored.add(l.loopContinue); + } + + for (int i = 0; i < caseBodies.size(); i++) { + List cc = new ArrayList(); + GraphPart nextCase = null; + nextCase = next; + if (next != null) { + if (i < caseBodies.size() - 1) { + if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = caseBodies.get(i + 1); + } + } else if (!defaultCommands.isEmpty()) { + if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = defaultPart; + } + } + } + cc.addAll(0, printGraph(registerNames, stack, allParts, null, caseBodies.get(i), nextCase, loops, forFinalCommands)); + if (cc.size() >= 2) { + if (cc.get(cc.size() - 1) instanceof BreakTreeItem) { + if ((cc.get(cc.size() - 2) instanceof ContinueTreeItem) || (cc.get(cc.size() - 2) instanceof BreakTreeItem)) { + cc.remove(cc.size() - 1); + } + } + } + caseCommands.add(cc); + } + + SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); + ret.add(sti); + + if (next != null) { + if (ti != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(registerNames, stack, allParts, null, next, stopPart, loops, forFinalCommands)); + } + } + return ret; + } + } else { + //ins.translate + } + //((IfTypeIns)ins.definition).translateInverted(new HashMap(), co.stack, ins); + } + + int ip = part.start; + List loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + boolean loop = false; + boolean reversed = false; + if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { + loop = true; + } else if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { + loop = true; + reversed = true; + } + if (((part.nextParts.size() == 2) || ((part.nextParts.size() == 1) && loop)) && (!isSwitch)) { + + boolean doWhile = loop; + if (loop && output.isEmpty()) { + doWhile = false; + } + Loop currentLoop = new Loop(part, null); + if (loop) { + loops.add(currentLoop); + } + + + + loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + + if (part.nextParts.size() > 1) { + currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); + } + + forFinalCommands.put(currentLoop, new ArrayList()); + + int breakIp = -1; + if (currentLoop.loopBreak != null) { + breakIp = currentLoop.loopBreak.start; + } + TreeItem expr = null; + if ((code.get(part.end) instanceof ActionJump) || (!(code.get(part.end) instanceof ActionIf))) { + expr = new DirectValueTreeItem(null, -1, (Boolean) true, new ArrayList()); + } else { + if (stack.isEmpty()) { + } + expr = stack.pop(); + } + if (doWhile) { + ret.add(new DoWhileTreeItem(null, breakIp, part.start, output, expr)); + } else { + ret.addAll(output); + } + + GraphPart next = part.getNextPartPath(loopContinues); + + if (loop && (!doWhile)) { + + if (reversed && (expr instanceof LogicalOp)) { + expr = ((LogicalOp) expr).invert(); + } + List loopBody = null; + List finalCommands = null; + GraphPart finalPart = null; + loopBody = printGraph(registerNames, stack, allParts, part, part.nextParts.get(reversed ? 1 : 0), stopPart, loops, forFinalCommands); + + finalCommands = forFinalCommands.get(currentLoop); + if (!finalCommands.isEmpty()) { + ret.add(new ForTreeItem(null, breakIp, currentLoop.loopContinue.start, new ArrayList(), expr, finalCommands, loopBody)); + } else { + ret.add(new WhileTreeItem(null, breakIp, part.start, expr, loopBody)); + } + } else if (!loop) { + if (expr instanceof LogicalOp) { + expr = ((LogicalOp) expr).invert(); + } else { + expr = new NotTreeItem(null, expr); + } + + int stackSizeBefore = stack.size(); + Stack trueStack = (Stack) stack.clone(); + Stack falseStack = (Stack) stack.clone(); + TreeItem lopTrue = checkLoop(part.nextParts.get(1), stopPart, loops); + TreeItem lopFalse = null; + if (next != part.nextParts.get(0)) { + lopFalse = checkLoop(part.nextParts.get(0), stopPart, loops); + } + List onTrue = new ArrayList(); + if (lopTrue != null) { + onTrue.add(lopTrue); + } else { + if (debugMode) { + System.err.println("ONTRUE: (inside " + part + ")"); + } + onTrue = printGraph(registerNames, trueStack, allParts, part, part.nextParts.get(1), next == null ? stopPart : next, loops, forFinalCommands); + if (debugMode) { + System.err.println("/ONTRUE (inside " + part + ")"); + } + } + List onFalse = new ArrayList(); + if (lopFalse != null) { + onFalse.add(lopFalse); + } else { + if (debugMode) { + System.err.println("ONFALSE: (inside " + part + ")"); + } + onFalse = (((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) ? new ArrayList() : printGraph(registerNames, falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands)); + if (debugMode) { + System.err.println("/ONFALSE (inside " + part + ")"); + } + } + + if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { + stack.push(new TernarOpTreeItem(null, expr, trueStack.pop(), falseStack.pop())); + } else { + ret.add(new IfTreeItem(null, expr, onTrue, onFalse)); + + //Same continues in onTrue and onFalse gets continue on parent level + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onTrue.get(onTrue.size() - 1) instanceof ContinueTreeItem) { + if (onFalse.get(onFalse.size() - 1) instanceof ContinueTreeItem) { + if (((ContinueTreeItem) onTrue.get(onTrue.size() - 1)).loopPos == ((ContinueTreeItem) onFalse.get(onFalse.size() - 1)).loopPos) { + onTrue.remove(onTrue.size() - 1); + ret.add(onFalse.remove(onFalse.size() - 1)); + } + } + } + } + } + } + if (loop && (part.nextParts.size() > 1)) { + loops.remove(currentLoop); //remove loop so no break shows up + ret.addAll(printGraph(registerNames, stack, allParts, part, part.nextParts.get(reversed ? 0 : 1), stopPart, loops, forFinalCommands)); + } + + if (next != null) { + TreeItem ti = checkLoop(next, stopPart, loops); + if (ti != null) { + ret.add(ti); + } else { + if (debugMode) { + System.err.println("NEXT: (inside " + part + ")"); + } + ret.addAll(printGraph(registerNames, stack, allParts, part, next, stopPart, loops, forFinalCommands)); + if (debugMode) { + System.err.println("/NEXT: (inside " + part + ")"); + } + } + + } + } else { + ret.addAll(output); + } + onepart: + if (part.nextParts.size() == 1 && (!loop)) { + + + GraphPart p = part.nextParts.get(0); + TreeItem lop = checkLoop(p, stopPart, loops); + if (lop == null) { + if (p.path.length() == part.path.length()) { + ret.addAll(printGraph(registerNames, stack, allParts, part, p, stopPart, loops, forFinalCommands)); + } else { + if ((p != stopPart) && (p.refs.size() > 1)) { + List nextList = new ArrayList(); + populateParts(p, nextList); + Loop nearestLoop = null; + loopn: + for (GraphPart n : nextList) { + for (Loop l : loops) { + if (l.loopContinue == n) { + nearestLoop = l; + break loopn; + } + } + } + if ((nearestLoop != null) && (nearestLoop.loopBreak != null)) { + List finalCommands = printGraph(registerNames, stack, allParts, part, p, nearestLoop.loopContinue, loops, forFinalCommands); + nearestLoop.loopContinue = p; + forFinalCommands.put(nearestLoop, finalCommands); + ContinueTreeItem cti = new ContinueTreeItem(null, nearestLoop.loopBreak.start); + ret.add(cti); + } + } + } + } else { + ret.add(lop); + } + } + return ret; + } + private List posCache; + + private void buildCache() { + posCache = new ArrayList(); + int pos = 0; + for (int i = 0; i < code.size(); i++) { + posCache.add(pos); + pos += code.get(i).getBytes(version).length; + } + posCache.add(pos); + } + + private int pos2adr(int pos) { + if (posCache == null) { + buildCache(); + } + return posCache.get(pos); + } + + private int adr2pos(int adr) { + if (posCache == null) { + buildCache(); + } + return posCache.indexOf(adr); + } + + private void visitCode(int ip, int lastIp, HashMap> refs) { + while (ip < code.size()) { + refs.get(ip).add(lastIp); + lastIp = ip; + if (refs.get(ip).size() > 1) { + break; + } + Action ins = code.get(ip); + if (ins instanceof ActionThrow) { + break; + } + if (ins instanceof ActionReturn) { + break; + } + + if (ins instanceof ActionJump) { + ip = adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionJump) ins).offset); + continue; + } else if (ins instanceof ActionIf) { + visitCode(adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionIf) ins).offset), ip, refs); + } + ip++; + }; + } + + public HashMap> visitCode() { + HashMap> refs = new HashMap>(); + for (int i = 0; i < code.size(); i++) { + refs.put(i, new ArrayList()); + } + visitCode(0, 0, refs); + return refs; + } + + private List makeGraph(List actions, List allBlocks) { + HashMap> refs = visitCode(); + List ret = new ArrayList(); + boolean visited[] = new boolean[code.size()]; + ret.add(makeGraph(null, "0", code, 0, 0, allBlocks, refs, visited)); + return ret; + } + + private GraphPart makeGraph(GraphPart parent, String path, List code, int startip, int lastIp, List allBlocks, HashMap> refs, boolean visited2[]) { + + int ip = startip; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + p.refs.add(parent); + return p; + } + } + GraphPart g; + GraphPart ret = new GraphPart(ip, -1); + ret.path = path; + GraphPart part = ret; + while (ip < code.size()) { + if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) { + part.end = lastIp; + GraphPart found = null; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + found = p; + break; + } + } + + allBlocks.add(part); + + if (found != null) { + part.nextParts.add(found); + found.refs.add(part); + break; + } else { + GraphPart gp = new GraphPart(ip, -1); + gp.path = path; + part.nextParts.add(gp); + gp.refs.add(part); + part = gp; + } + } + lastIp = ip; + Action ins = code.get(ip); + if ((ins instanceof ActionThrow) || (ins instanceof ActionReturn)) { + part.end = ip; + allBlocks.add(part); + break; + } + if (ins instanceof ActionJump) { + part.end = ip; + allBlocks.add(part); + int newip = adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionJump) ins).offset); + part.nextParts.add(g = makeGraph(part, path, code, newip, lastIp, allBlocks, refs, visited2)); + g.refs.add(part); + break; + } else if (ins instanceof ActionIf) { + part.end = ip; + allBlocks.add(part); + part.nextParts.add(g = makeGraph(part, path + "0", code, adr2pos(pos2adr(ip) + ins.getBytes(version).length + ((ActionIf) ins).offset), ip, allBlocks, refs, visited2)); + g.refs.add(part); + part.nextParts.add(g = makeGraph(part, path + "1", code, ip + 1, ip, allBlocks, refs, visited2)); + g.refs.add(part); + + break; + } + ip++; + }; + if (ip == code.size()) { + allBlocks.add(part); + if (part.start == ip) { + part.end = ip; + } else { + part.end = code.size() - 1; + part.nextParts.add(makeGraph(part, path, code, ip, ip, allBlocks, refs, visited2)); + } + + } + return ret; + } + */ } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java new file mode 100644 index 000000000..48edd4c78 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -0,0 +1,55 @@ +package com.jpexs.decompiler.flash.action; + +import com.jpexs.decompiler.flash.graph.GraphSource; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import java.util.HashMap; +import java.util.List; +import java.util.Stack; + +/** + * + * @author JPEXS + */ +public class ActionGraphSource extends GraphSource { + + private List actions; + public int version; + private HashMap registerNames; + + public ActionGraphSource(List actions, int version, HashMap registerNames) { + this.actions = actions; + this.version = version; + this.registerNames = registerNames; + } + + @Override + public int size() { + return actions.size(); + } + + @Override + public GraphSourceItem get(int pos) { + return actions.get(pos); + } + + @Override + public boolean isEmpty() { + return actions.isEmpty(); + } + + @Override + public List translatePart(List localData, Stack stack, int start, int end) { + return (Action.actionsPartToTree(registerNames, stack, actions, start, end, version)); + } + + @Override + public int adr2pos(long adr) { + return Action.adr2ip(actions, adr, version); + } + + @Override + public long pos2adr(int pos) { + return Action.ip2adr(actions, pos, version); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java index fc9bc2d03..d23a6fa31 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.flashlite; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.FSCommand2TreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionFSCommand2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { long numArgs = popLong(stack); - TreeItem command = stack.pop(); - List args = new ArrayList(); + GraphTargetItem command = stack.pop(); + List args = new ArrayList(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java index 0a12bc17b..583588a33 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.StrictModeTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -60,7 +60,7 @@ public class ActionStrictMode extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new StrictModeTreeItem(this, mode)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java index 8a8fb7a05..d2f64d24b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java @@ -34,6 +34,7 @@ import java.awt.event.ActionListener; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import javax.swing.*; import javax.swing.border.BevelBorder; @@ -268,7 +269,7 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("GRAPH")) { if (lastCode != null) { - GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, SWF.DEFAULT_VERSION), ""); + GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap(), SWF.DEFAULT_VERSION), ""); gf.setVisible(true); } } else if (e.getActionCommand().equals("EDITACTION")) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/special/ActionNop.java b/trunk/src/com/jpexs/decompiler/flash/action/special/ActionNop.java index faa93ee2d..88b656b82 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/special/ActionNop.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/special/ActionNop.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.action.special; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import java.util.List; import java.util.Stack; @@ -33,7 +32,7 @@ public class ActionNop extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { //output.add(new SimpleActionTreeItem(this, "nop();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java index 35f035c18..32e828f37 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GetURLTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -68,7 +68,7 @@ public class ActionGetURL extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new GetURLTreeItem(this, urlString, targetString)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java index 346003bd7..98c47aea7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGoToLabel.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GotoLabelTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -64,7 +64,7 @@ public class ActionGoToLabel extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new GotoLabelTreeItem(this, label)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java index 4e5676a56..eb17d2990 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GotoFrameTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -60,7 +60,7 @@ public class ActionGotoFrame extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new GotoFrameTreeItem(this, frame)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionNextFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionNextFrame.java index 923ba78c4..230c22f11 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionNextFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionNextFrame.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionNextFrame extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "nextFrame();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPlay.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPlay.java index a9fa1aa2c..0a2bb946b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPlay.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPlay.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionPlay extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "Play();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPrevFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPrevFrame.java index 20f0858a5..e4d56bb4a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPrevFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionPrevFrame.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionPrevFrame extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "prevFrame();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java index 2cb11af07..b5f3ce190 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionSetTarget.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.SetTargetTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -64,7 +64,7 @@ public class ActionSetTarget extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SetTargetTreeItem(this, targetName)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStop.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStop.java index 52a98b45d..8d358cc8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStop.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStop.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionStop extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stop();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStopSounds.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStopSounds.java index e818a3131..32d9b8d0f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStopSounds.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionStopSounds.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionStopSounds extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stopAllSounds();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionToggleQuality.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionToggleQuality.java index 9ac01e3a4..4fb0b4bc3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionToggleQuality.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionToggleQuality.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf3; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionToggleQuality extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "toggleHighQuality();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java index 9f5ef335c..98270882c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionWaitForFrame.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.WaitForFrameTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -64,7 +64,7 @@ public class ActionWaitForFrame extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new WaitForFrameTreeItem(this, frame, skipCount)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAdd.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAdd.java index 87d44b7b5..d4505e146 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAdd.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAdd.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.AddTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionAdd extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new AddTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAnd.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAnd.java index 180ab8322..286f702b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAnd.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAnd.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.AndTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionAnd extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new AndTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java index dabb2da8c..13eb60d67 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionAsciiToChar.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.AsciiToCharTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionAsciiToChar extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new AsciiToCharTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCall.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCall.java index d04c5458e..c3cb2b06a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCall.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCall.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CallTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionCall extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new CallTreeItem(this, stack.pop())); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCharToAscii.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCharToAscii.java index 88e8f11e8..93426ed9a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCharToAscii.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCharToAscii.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CharToAsciiTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionCharToAscii extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new CharToAsciiTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCloneSprite.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCloneSprite.java index 50e30c79d..14f41eda1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCloneSprite.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionCloneSprite.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CloneSpriteTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,10 +34,10 @@ public class ActionCloneSprite extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem depth = stack.pop(); - TreeItem target = stack.pop(); - TreeItem source = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem depth = stack.pop(); + GraphTargetItem target = stack.pop(); + GraphTargetItem source = stack.pop(); output.add(new CloneSpriteTreeItem(this, source, target, depth)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionDivide.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionDivide.java index d0ae8cc84..3ee80c3f1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionDivide.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionDivide.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.DivideTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionDivide extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new DivideTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEndDrag.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEndDrag.java index f1ae101d6..9c6b93e76 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEndDrag.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEndDrag.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionEndDrag extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { output.add(new SimpleActionTreeItem(this, "stopDrag();")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java index d5434159f..610f3aa6e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.EqTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionEquals extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new EqTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java index a430039c6..b4be61fa2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetProperty.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.GetPropertyTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -35,9 +35,9 @@ public class ActionGetProperty extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem index = stack.pop(); - TreeItem target = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem index = stack.pop(); + GraphTargetItem target = stack.pop(); int indexInt = 0; if (index instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) index).value instanceof Long) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetTime.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetTime.java index 905ad57e8..6c0711523 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetTime.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetTime.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SimpleActionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,7 +34,7 @@ public class ActionGetTime extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { stack.push(new SimpleActionTreeItem(this, "getTimer()")); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java index f37fd2cd3..d81918ba1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetURL2.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GetURL2TreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -72,9 +72,9 @@ public class ActionGetURL2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem targetString = stack.pop(); - TreeItem urlString = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem targetString = stack.pop(); + GraphTargetItem urlString = stack.pop(); output.add(new GetURL2TreeItem(this, urlString, targetString, sendVarsMethod, loadTargetFlag, loadTargetFlag)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetVariable.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetVariable.java index d9449c71e..380d940ca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetVariable.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGetVariable.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.GetVariableTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionGetVariable extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); stack.push(new GetVariableTreeItem(this, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java index 1bf3c4971..fdcfde588 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionGotoFrame2.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.treemodel.GotoFrame2TreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -76,8 +76,8 @@ public class ActionGotoFrame2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem frame = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem frame = stack.pop(); output.add(new GotoFrame2TreeItem(this, frame, sceneBiasFlag, playFlag, sceneBias)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java index 174f09edc..893093c49 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java @@ -19,8 +19,10 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.action.ActionGraphSource; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; +import com.jpexs.decompiler.flash.graph.GraphSource; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -81,4 +83,17 @@ public class ActionIf extends Action { public String toString() { return "ActionIf"; } + + @Override + public boolean isBranch() { + return true; + } + + @Override + public List getBranches(GraphSource code) { + List ret = super.getBranches(code); + ret.add(code.adr2pos(getAddress() + getBytes(((ActionGraphSource) code).version).length + offset)); + ret.add(code.adr2pos(getAddress() + getBytes(((ActionGraphSource) code).version).length)); + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java index 40078e4ce..de9cb979e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java @@ -19,8 +19,10 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.action.ActionGraphSource; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; +import com.jpexs.decompiler.flash.graph.GraphSource; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -86,4 +88,16 @@ public class ActionJump extends Action { public String toString() { return "Jump"; } + + @Override + public boolean isJump() { + return true; + } + + @Override + public List getBranches(GraphSource code) { + List ret = super.getBranches(code); + ret.add(code.adr2pos(getAddress() + getBytes(((ActionGraphSource) code).version).length + offset)); + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionLess.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionLess.java index 946666418..bfc2796b7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionLess.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionLess.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.LtTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionLess extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new LtTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java index d309a6778..8705c4e01 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBAsciiToChar.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.MBAsciiToCharTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionMBAsciiToChar extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new MBAsciiToCharTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBCharToAscii.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBCharToAscii.java index b9667f321..e38cb9444 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBCharToAscii.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBCharToAscii.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.MBCharToAsciiTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionMBCharToAscii extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new MBCharToAsciiTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringExtract.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringExtract.java index 06ef3a931..f819fac74 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringExtract.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringExtract.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.MBStringExtractTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,10 +34,10 @@ public class ActionMBStringExtract extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem count = stack.pop(); - TreeItem index = stack.pop(); - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem count = stack.pop(); + GraphTargetItem index = stack.pop(); + GraphTargetItem value = stack.pop(); stack.push(new MBStringExtractTreeItem(this, value, index, count)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringLength.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringLength.java index e4abf9019..b95e73882 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringLength.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMBStringLength.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.MBStringLengthTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionMBStringLength extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new MBStringLengthTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMultiply.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMultiply.java index c4c313874..a9b3b60e7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMultiply.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionMultiply.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.MultiplyTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionMultiply extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new MultiplyTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionNot.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionNot.java index fbee7d4ce..702f13c18 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionNot.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionNot.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.NotTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionNot extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new NotTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionOr.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionOr.java index 51c7af64d..0642f27c4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionOr.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionOr.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.OrTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionOr extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new OrTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java index d3a5a1156..b487527f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPop.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CallFunctionTreeItem; import com.jpexs.decompiler.flash.action.treemodel.CallMethodTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -35,11 +35,11 @@ public class ActionPop extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { if (stack.isEmpty()) { return; } - TreeItem val = stack.pop(); + GraphTargetItem val = stack.pop(); if ((val instanceof CallFunctionTreeItem) || (val instanceof CallMethodTreeItem)) { output.add(val); } 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 64c34ac2a..633ffaf53 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.ParsedSymbol; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -203,7 +203,7 @@ public class ActionPush extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { int pos = 0; for (Object o : values) { if (o instanceof ConstantIndex) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRandomNumber.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRandomNumber.java index 4a5464394..e4cac4669 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRandomNumber.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRandomNumber.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.RandomNumberTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionRandomNumber extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem maximum = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem maximum = stack.pop(); stack.push(new RandomNumberTreeItem(this, maximum)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRemoveSprite.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRemoveSprite.java index 33d55df1e..963096c45 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRemoveSprite.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionRemoveSprite.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.RemoveSpriteTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionRemoveSprite extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem target = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem target = stack.pop(); output.add(new RemoveSpriteTreeItem(this, target)); } } 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 4f051158e..43ef22c60 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.SetPropertyTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionSetProperty extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); - TreeItem index = stack.pop(); - TreeItem target = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); + GraphTargetItem index = stack.pop(); + GraphTargetItem target = stack.pop(); int indexInt = 0; if (index instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) index).value instanceof Long) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetTarget2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetTarget2.java index e37df3e13..9401d7d9f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetTarget2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetTarget2.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SetTarget2TreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionSetTarget2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem target = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem target = stack.pop(); output.add(new SetTarget2TreeItem(this, target)); } } 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 c2077f53e..e2bc02e64 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSetVariable.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SetVariableTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionSetVariable extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); - TreeItem name = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); + GraphTargetItem name = stack.pop(); output.add(new SetVariableTreeItem(this, name, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java index 73bccb340..02f614dec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStartDrag.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.StartDragTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionStartDrag extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem target = stack.pop(); - TreeItem lockCenter = stack.pop(); - TreeItem constrain = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem target = stack.pop(); + GraphTargetItem lockCenter = stack.pop(); + GraphTargetItem constrain = stack.pop(); boolean hasConstrains = true; if (constrain instanceof DirectValueTreeItem) { @@ -53,10 +53,10 @@ public class ActionStartDrag extends Action { } } } - TreeItem x1 = null; - TreeItem y1 = null; - TreeItem x2 = null; - TreeItem y2 = null; + GraphTargetItem x1 = null; + GraphTargetItem y1 = null; + GraphTargetItem x2 = null; + GraphTargetItem y2 = null; if (hasConstrains) { y2 = stack.pop(); x2 = stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringAdd.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringAdd.java index 735bba8f4..6c7bcd50a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringAdd.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringAdd.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StringAddTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionStringAdd extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new StringAddTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringEquals.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringEquals.java index 53bdbb893..7e4678aa6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringEquals.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringEquals.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StringEqTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionStringEquals extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new StringEqTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringExtract.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringExtract.java index 752866819..131dc2b84 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringExtract.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringExtract.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.StringExtractTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,10 +34,10 @@ public class ActionStringExtract extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem count = stack.pop(); - TreeItem index = stack.pop(); - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem count = stack.pop(); + GraphTargetItem index = stack.pop(); + GraphTargetItem value = stack.pop(); stack.push(new StringExtractTreeItem(this, value, index, count)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLength.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLength.java index 4c63a39c4..208b7ecc9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLength.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLength.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StringLengthTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionStringLength extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new StringLengthTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLess.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLess.java index 53337b1ed..b0e9b92cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLess.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionStringLess.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StringLtTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionStringLess extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new StringLtTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSubtract.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSubtract.java index 5304d6ba7..91ed96047 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSubtract.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionSubtract.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.SubtractTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionSubtract extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new SubtractTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java index cf9ef0b53..ef1212f35 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionToInteger.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ToIntegerTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionToInteger extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new ToIntegerTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionTrace.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionTrace.java index 34b8703ad..3bee84b1e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionTrace.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionTrace.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TraceTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionTrace extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); output.add(new TraceTreeItem(this, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java index 8d5426e02..c6d395f6c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionWaitForFrame2.java @@ -21,8 +21,8 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.WaitForFrame2TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -60,8 +60,8 @@ public class ActionWaitForFrame2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem frame = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem frame = stack.pop(); output.add(new WaitForFrame2TreeItem(this, frame, skipCount)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionAdd2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionAdd2.java index c03df533a..b4adc29e2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionAdd2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionAdd2.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.AddTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionAdd2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new AddTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java index 248566443..de5cabc69 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitAnd.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.BitAndTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitAnd extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new BitAndTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java index 21e7da2db..83737cb4d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitLShift.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.LShiftTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitLShift extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new LShiftTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java index 09fc071f4..1dc463a4a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitOr.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.BitOrTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitOr extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new BitOrTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java index 63ffd40fd..fd73ec663 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitRShift.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.RShiftTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitRShift extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new RShiftTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitURShift.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitURShift.java index b8502765b..4a49a9140 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitURShift.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitURShift.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.URShiftTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitURShift extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new URShiftTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java index 26bbe4cac..6069b5779 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionBitXor.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.BitXorTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionBitXor extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new BitXorTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallFunction.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallFunction.java index b6e51fa97..d1df16a9a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallFunction.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CallFunctionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionCallFunction extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem functionName = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem functionName = stack.pop(); long numArgs = popLong(stack); - List args = new ArrayList(); + List args = new ArrayList(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallMethod.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallMethod.java index eb3cad70b..829cc3b98 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallMethod.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionCallMethod.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CallMethodTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,11 +35,11 @@ public class ActionCallMethod extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem methodName = stack.pop(); - TreeItem scriptObject = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem methodName = stack.pop(); + GraphTargetItem scriptObject = stack.pop(); long numArgs = popLong(stack); - List args = new ArrayList(); + List args = new ArrayList(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java index 9f94b2e84..b81b5e8e1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java @@ -22,7 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.ParsedSymbol; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -85,6 +85,6 @@ public class ActionConstantPool extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDecrement.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDecrement.java index 451f4fdab..1a38a59f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDecrement.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDecrement.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DecrementTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionDecrement extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new DecrementTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java index c6e0b8249..73e2c3f87 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java @@ -26,7 +26,7 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -153,7 +153,7 @@ public class ActionDefineFunction extends Action { } @Override - public void translate(Stack stack, List output, HashMap regNames) { + public void translate(Stack stack, List output, HashMap regNames) { stack.push(new FunctionTreeItem(this, functionName, paramNames, Action.actionsToTree(regNames, code, version), constantPool, 1)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal.java index 5a781c874..f75c1e86b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DefineLocalTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionDefineLocal extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); - TreeItem name = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); + GraphTargetItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal2.java index c78346fa2..d89af087f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineLocal2.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DefineLocalTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionDefineLocal2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem name = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, null)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete.java index 9f69754c4..7c67d395e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DeleteTreeItem; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -36,9 +36,9 @@ public class ActionDelete extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem propertyName = stack.pop(); - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem propertyName = stack.pop(); + GraphTargetItem object = stack.pop(); output.add(new DeleteTreeItem(this, object, propertyName)); stack.push(new DirectValueTreeItem(this, -1, Boolean.TRUE, new ArrayList())); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete2.java index 7bc2ddcea..be549581a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDelete2.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.DeleteTreeItem; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -36,8 +36,8 @@ public class ActionDelete2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem propertyName = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem propertyName = stack.pop(); output.add(new DeleteTreeItem(this, null, propertyName)); stack.push(new DirectValueTreeItem(this, -1, Boolean.TRUE, new ArrayList())); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java index 495a3036c..319370f91 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEnumerate.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.EnumerateTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionEnumerate extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEquals2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEquals2.java index 94536d86a..6d3b9d067 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEquals2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionEquals2.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.EqTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionEquals2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new EqTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionGetMember.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionGetMember.java index 1b5072121..a0c16400e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionGetMember.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionGetMember.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.GetMemberTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionGetMember extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem functionName = stack.pop(); - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem functionName = stack.pop(); + GraphTargetItem object = stack.pop(); stack.push(new GetMemberTreeItem(this, object, functionName)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionIncrement.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionIncrement.java index 04d8ab393..ff63ef001 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionIncrement.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionIncrement.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.IncrementTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionIncrement extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); stack.push(new IncrementTreeItem(this, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitArray.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitArray.java index 6af86ddec..02afbe508 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitArray.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitArray.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.InitArrayTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -30,9 +30,9 @@ public class ActionInitArray extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { long numArgs = popLong(stack); - List args = new ArrayList(); + List args = new ArrayList(); for (int l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitObject.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitObject.java index b16a072dc..87f03c8d7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitObject.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionInitObject.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.InitObjectTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionInitObject extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { + public void translate(Stack stack, List output, java.util.HashMap regNames) { long numArgs = popLong(stack); - List values = new ArrayList(); - List names = new ArrayList(); + List values = new ArrayList(); + List names = new ArrayList(); for (long l = 0; l < numArgs; l++) { values.add(stack.pop()); names.add(stack.pop()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionLess2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionLess2.java index c286078d2..b73170857 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionLess2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionLess2.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.LtTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionLess2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new LtTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionModulo.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionModulo.java index 76c54414a..ea5a603ef 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionModulo.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionModulo.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.ModuloTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionModulo extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new ModuloTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewMethod.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewMethod.java index b995ff447..b604e96c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewMethod.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewMethod.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.NewMethodTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,11 +35,11 @@ public class ActionNewMethod extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem methodName = stack.pop(); - TreeItem scriptObject = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem methodName = stack.pop(); + GraphTargetItem scriptObject = stack.pop(); long numArgs = popLong(stack); - List args = new ArrayList(); + List args = new ArrayList(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewObject.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewObject.java index f29454b89..88726b254 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewObject.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionNewObject.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.NewObjectTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionNewObject extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem objectName = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem objectName = stack.pop(); long numArgs = popLong(stack); - List args = new ArrayList(); + List args = new ArrayList(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java index 0bd9b1d25..662fc7491 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.IgnoredPair; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,10 +34,10 @@ public class ActionPushDuplicate extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); stack.push(value); stack.push(value); - value.moreInstructions.add(new IgnoredPair(this, 0)); + value.moreSrc.add(new GraphSourceItemPos(this, 0)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionReturn.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionReturn.java index 13fcf7bf7..74b791467 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionReturn.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionReturn.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ReturnTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,13 @@ public class ActionReturn extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); output.add(new ReturnTreeItem(this, value)); } + + @Override + public boolean isExit() { + return true; + } } 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 ec80bfc22..eeec2e98e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionSetMember.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.SetMemberTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,10 +34,10 @@ public class ActionSetMember extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem value = stack.pop(); - TreeItem objectName = stack.pop(); - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem value = stack.pop(); + GraphTargetItem objectName = stack.pop(); + GraphTargetItem object = stack.pop(); output.add(new SetMemberTreeItem(this, object, objectName, value)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java index dfb8a85a4..27695e36b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -33,9 +33,9 @@ public class ActionStackSwap extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(a); stack.push(b); } 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 9bb018165..d5f01689e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java @@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.action.parser.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.treemodel.StoreRegisterTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -61,8 +61,8 @@ public class ActionStoreRegister extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem item = stack.peek(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem item = stack.peek(); RegisterNumber rn = new RegisterNumber(registerNumber); if (regNames.containsKey(registerNumber)) { rn.name = regNames.get(registerNumber); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTargetPath.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTargetPath.java index 599a32d72..d2b2e02e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTargetPath.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTargetPath.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TargetPathTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionTargetPath extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new TargetPathTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToNumber.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToNumber.java index dddb11592..31941add3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToNumber.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToNumber.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ToNumberTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionToNumber extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new ToNumberTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToString.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToString.java index a6c194d46..dcdcbf617 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToString.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionToString.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ToStringTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionToString extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new ToStringTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTypeOf.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTypeOf.java index af39a86d5..a7d702039 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTypeOf.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionTypeOf.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.TypeOfTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionTypeOf extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new TypeOfTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java index 073279296..68aee4599 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf6; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.EnumerateTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,8 @@ public class ActionEnumerate2 extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionGreater.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionGreater.java index 8c6a32a33..723d8deee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionGreater.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionGreater.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf6; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.GtTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionGreater extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionInstanceOf.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionInstanceOf.java index 15bceb1ed..0dfc70cba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionInstanceOf.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionInstanceOf.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf6; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.InstanceOfTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionInstanceOf extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new InstanceOfTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStrictEquals.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStrictEquals.java index d4a3d5469..077b015cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStrictEquals.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStrictEquals.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf6; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.StrictEqTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionStrictEquals extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new StrictEqTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStringGreater.java b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStringGreater.java index e5681e5c7..04b44f0a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStringGreater.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf6/ActionStringGreater.java @@ -17,8 +17,8 @@ package com.jpexs.decompiler.flash.action.swf6; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import com.jpexs.decompiler.flash.action.treemodel.operations.GtTreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionStringGreater extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem a = stack.pop(); - TreeItem b = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem a = stack.pop(); + GraphTargetItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionCastOp.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionCastOp.java index 35b7c1889..168f9e43a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionCastOp.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionCastOp.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf7; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.CastOpTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionCastOp extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); - TreeItem constructor = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); + GraphTargetItem constructor = stack.pop(); stack.push(new CastOpTreeItem(this, constructor, object)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java index fcc2e3609..f59ec8d40 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java @@ -26,7 +26,7 @@ import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf5.ActionDefineFunction; import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -238,7 +238,7 @@ public class ActionDefineFunction2 extends Action { } @Override - public void translate(Stack stack, List output, HashMap regNames) { + public void translate(Stack stack, List output, HashMap regNames) { stack.push(new FunctionTreeItem(this, functionName, paramNames, Action.actionsToTree(regNames, code, version), constantPool, getFirstRegister())); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java index c922eccb8..deba93690 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf7; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ExtendsTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,9 +34,9 @@ public class ActionExtends extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem superclass = stack.pop(); - TreeItem subclass = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem superclass = stack.pop(); + GraphTargetItem subclass = stack.pop(); output.add(new ExtendsTreeItem(this, subclass, superclass)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionImplementsOp.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionImplementsOp.java index d42e92da9..513b9fd28 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionImplementsOp.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionImplementsOp.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf7; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ImplementsOpTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -35,10 +35,10 @@ public class ActionImplementsOp extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem subclass = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem subclass = stack.pop(); long inCount = popLong(stack); - List superclasses = new ArrayList(); + List superclasses = new ArrayList(); for (long l = 0; l < inCount; l++) { superclasses.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionThrow.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionThrow.java index c52b9ff97..9d2613727 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionThrow.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionThrow.java @@ -18,7 +18,7 @@ package com.jpexs.decompiler.flash.action.swf7; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ThrowTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; import java.util.Stack; @@ -34,8 +34,13 @@ public class ActionThrow extends Action { } @Override - public void translate(Stack stack, List output, java.util.HashMap regNames) { - TreeItem object = stack.pop(); + public void translate(Stack stack, List output, java.util.HashMap regNames) { + GraphTargetItem object = stack.pop(); output.add(new ThrowTreeItem(this, object)); } + + @Override + public boolean isExit() { + return true; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/AsciiToCharTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/AsciiToCharTreeItem.java index da3f3df3b..7299bc039 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/AsciiToCharTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/AsciiToCharTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class AsciiToCharTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public AsciiToCharTreeItem(Action instruction, TreeItem value) { + public AsciiToCharTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class AsciiToCharTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallFunctionTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallFunctionTreeItem.java index 2a9bac685..2a7ac7324 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallFunctionTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallFunctionTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class CallFunctionTreeItem extends TreeItem { - public TreeItem functionName; - public List arguments; + public GraphTargetItem functionName; + public List arguments; - public CallFunctionTreeItem(Action instruction, TreeItem functionName, List arguments) { + public CallFunctionTreeItem(GraphSourceItem instruction, GraphTargetItem functionName, List arguments) { super(instruction, PRECEDENCE_PRIMARY); this.functionName = functionName; this.arguments = arguments; @@ -43,11 +44,11 @@ public class CallFunctionTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(functionName.getNeededActions()); - for (TreeItem ti : arguments) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(functionName.getNeededSources()); + for (GraphTargetItem ti : arguments) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallMethodTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallMethodTreeItem.java index 4a7c6c315..93398d9c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallMethodTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallMethodTreeItem.java @@ -16,17 +16,18 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.Undefined; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class CallMethodTreeItem extends TreeItem { - public TreeItem methodName; - public TreeItem scriptObject; - public List arguments; + public GraphTargetItem methodName; + public GraphTargetItem scriptObject; + public List arguments; - public CallMethodTreeItem(Action instruction, TreeItem scriptObject, TreeItem methodName, List arguments) { + public CallMethodTreeItem(GraphSourceItem instruction, GraphTargetItem scriptObject, GraphTargetItem methodName, List arguments) { super(instruction, PRECEDENCE_PRIMARY); this.methodName = methodName; this.arguments = arguments; @@ -60,12 +61,12 @@ public class CallMethodTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(methodName.getNeededActions()); - ret.addAll(scriptObject.getNeededActions()); - for (TreeItem ti : arguments) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(methodName.getNeededSources()); + ret.addAll(scriptObject.getNeededSources()); + for (GraphTargetItem ti : arguments) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallTreeItem.java index 24432e6b9..36a20fbf5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CallTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class CallTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public CallTreeItem(Action instruction, TreeItem value) { + public CallTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class CallTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CastOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CastOpTreeItem.java index 163f05537..abe45145e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CastOpTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CastOpTreeItem.java @@ -16,15 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class CastOpTreeItem extends TreeItem { - public TreeItem constructor; - public TreeItem object; + public GraphTargetItem constructor; + public GraphTargetItem object; - public CastOpTreeItem(Action instruction, TreeItem constructor, TreeItem object) { + public CastOpTreeItem(GraphSourceItem instruction, GraphTargetItem constructor, GraphTargetItem object) { super(instruction, PRECEDENCE_PRIMARY); this.constructor = constructor; this.object = object; @@ -32,14 +34,14 @@ public class CastOpTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return hilight("(") + stripQuotes(constructor) + hilight(")") + object.toString(constants); + return hilight("(") + stripQuotes(constructor) + hilight(")") + object.toString(Helper.toList(constants)); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(constructor.getNeededActions()); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(constructor.getNeededSources()); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CharToAsciiTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CharToAsciiTreeItem.java index 1fc995500..ea35347b6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CharToAsciiTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CharToAsciiTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class CharToAsciiTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public CharToAsciiTreeItem(Action instruction, TreeItem value) { + public CharToAsciiTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class CharToAsciiTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CloneSpriteTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CloneSpriteTreeItem.java index 6530f45b2..2c84bdd4c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CloneSpriteTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/CloneSpriteTreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class CloneSpriteTreeItem extends TreeItem { - public TreeItem source; - public TreeItem target; - public TreeItem depth; + public GraphTargetItem source; + public GraphTargetItem target; + public GraphTargetItem depth; - public CloneSpriteTreeItem(Action instruction, TreeItem source, TreeItem target, TreeItem depth) { + public CloneSpriteTreeItem(GraphSourceItem instruction, GraphTargetItem source, GraphTargetItem target, GraphTargetItem depth) { super(instruction, PRECEDENCE_PRIMARY); this.source = source; this.target = target; @@ -34,15 +35,15 @@ public class CloneSpriteTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return hilight("duplicateMovieClip(") + target.toString(constants) + hilight(",") + source.toString(constants) + hilight(",") + depth.toString(constants) + hilight(")") + ";"; + return hilight("duplicateMovieClip(") + target.toString(constants) + hilight(",") + source.toString(constants) + hilight(",") + depth.toString(constants) + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(source.getNeededActions()); - ret.addAll(target.getNeededActions()); - ret.addAll(depth.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(source.getNeededSources()); + ret.addAll(target.getNeededSources()); + ret.addAll(depth.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ContinueTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ContinueTreeItem.java deleted file mode 100644 index 7f79f3ac8..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ContinueTreeItem.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel; - -import com.jpexs.decompiler.flash.action.Action; - -public class ContinueTreeItem extends TreeItem { - - public long loopPos; - public boolean isKnown; - public boolean isBreak; - - public ContinueTreeItem(Action instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public ContinueTreeItem(Action instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(isBreak ? "break" : "continue") + " " + (isKnown ? "loop" : "unk") + loopPos + ";"; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DecrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DecrementTreeItem.java index ba553d12f..1ff1b63ec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DecrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DecrementTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class DecrementTreeItem extends TreeItem { - public TreeItem object; + public GraphTargetItem object; - public DecrementTreeItem(Action instruction, TreeItem object) { + public DecrementTreeItem(GraphSourceItem instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_ADDITIVE); this.object = object; } @@ -44,9 +45,9 @@ public class DecrementTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DefineLocalTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DefineLocalTreeItem.java index f2ac40633..7ccbb7387 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DefineLocalTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DefineLocalTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class DefineLocalTreeItem extends TreeItem { - public TreeItem name; - public TreeItem value; + public GraphTargetItem name; + public GraphTargetItem value; - public DefineLocalTreeItem(Action instruction, TreeItem name, TreeItem value) { + public DefineLocalTreeItem(GraphSourceItem instruction, GraphTargetItem name, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.name = name; this.value = value; @@ -39,10 +40,10 @@ public class DefineLocalTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); - ret.addAll(name.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); + ret.addAll(name.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DeleteTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DeleteTreeItem.java index 4952634ce..07c7cb24f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DeleteTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DeleteTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class DeleteTreeItem extends TreeItem { - public TreeItem object; - public TreeItem propertyName; + public GraphTargetItem object; + public GraphTargetItem propertyName; - public DeleteTreeItem(Action instruction, TreeItem object, TreeItem propertyName) { + public DeleteTreeItem(GraphSourceItem instruction, GraphTargetItem object, GraphTargetItem propertyName) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; this.propertyName = propertyName; @@ -39,10 +40,10 @@ public class DeleteTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); - ret.addAll(propertyName.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); + ret.addAll(propertyName.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java index f750bd0e6..af406068d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java @@ -16,8 +16,8 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; @@ -26,7 +26,7 @@ public class DirectValueTreeItem extends TreeItem { public Object value; public List constants; - public DirectValueTreeItem(Action instruction, int instructionPos, Object value, List constants) { + public DirectValueTreeItem(GraphSourceItem instruction, int instructionPos, Object value, List constants) { super(instruction, PRECEDENCE_PRIMARY); this.constants = constants; this.value = value; @@ -65,7 +65,7 @@ public class DirectValueTreeItem extends TreeItem { } @Override - public String toStringNoQuotes(ConstantPool constants) { + public String toStringNoQuotes(List localData) { if (value instanceof Double) { if (Double.compare((double) (Double) value, 0) == 0) { return hilight("0"); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EachTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EachTreeItem.java index 69a94b4d0..275c25767 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EachTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EachTreeItem.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; import java.util.List; public class EachTreeItem extends TreeItem { @@ -24,7 +24,7 @@ public class EachTreeItem extends TreeItem { public TreeItem object; public TreeItem collection; - public EachTreeItem(Action instruction, TreeItem object, TreeItem collection) { + public EachTreeItem(GraphSourceItem instruction, TreeItem object, TreeItem collection) { super(instruction, NOPRECEDENCE); this.object = object; this.collection = collection; @@ -36,10 +36,10 @@ public class EachTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); - ret.addAll(collection.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); + ret.addAll(collection.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EnumerateTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EnumerateTreeItem.java index eabba9b41..f280370a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EnumerateTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/EnumerateTreeItem.java @@ -16,27 +16,29 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class EnumerateTreeItem extends TreeItem { - public TreeItem object; + public GraphTargetItem object; - public EnumerateTreeItem(Action instruction, TreeItem object) { + public EnumerateTreeItem(GraphSourceItem instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; } @Override public String toString(ConstantPool constants) { - return "enumerate " + object.toString(constants); + return "enumerate " + object.toString(Helper.toList(constants)); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ExtendsTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ExtendsTreeItem.java index 00ae50c85..1e7f80946 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ExtendsTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ExtendsTreeItem.java @@ -16,15 +16,18 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import java.util.ArrayList; import java.util.List; public class ExtendsTreeItem extends TreeItem { - public TreeItem subclass; - public TreeItem superclass; + public GraphTargetItem subclass; + public GraphTargetItem superclass; - public ExtendsTreeItem(Action instruction, TreeItem subclass, TreeItem superclass) { + public ExtendsTreeItem(GraphSourceItem instruction, GraphTargetItem subclass, GraphTargetItem superclass) { super(instruction, PRECEDENCE_PRIMARY); this.subclass = subclass; this.superclass = superclass; @@ -32,14 +35,16 @@ public class ExtendsTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return subclass.toString(constants) + hilight(" extends ") + stripQuotes(superclass); + List localData = new ArrayList(); + localData.add(constants); + return subclass.toString(localData) + hilight(" extends ") + stripQuotes(superclass); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(subclass.getNeededActions()); - ret.addAll(superclass.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(subclass.getNeededSources()); + ret.addAll(superclass.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FSCommand2TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FSCommand2TreeItem.java index 5a8485057..508fa12d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FSCommand2TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FSCommand2TreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class FSCommand2TreeItem extends TreeItem { public String target; - public List arguments; - public TreeItem command; + public List arguments; + public GraphTargetItem command; - public FSCommand2TreeItem(Action instruction, TreeItem command, List arguments) { + public FSCommand2TreeItem(GraphSourceItem instruction, GraphTargetItem command, List arguments) { super(instruction, PRECEDENCE_PRIMARY); this.command = command; this.arguments = arguments; @@ -38,15 +39,15 @@ public class FSCommand2TreeItem extends TreeItem { paramStr += ","; paramStr += arguments.get(t).toString(constants); } - return hilight("FSCommand2(") + command.toString(constants) + paramStr + hilight(")") + ";"; + return hilight("FSCommand2(") + command.toString(constants) + paramStr + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(command.getNeededActions()); - for (TreeItem ti : arguments) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(command.getNeededSources()); + for (GraphTargetItem ti : arguments) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FunctionTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FunctionTreeItem.java index 32590831a..7c17e21df 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FunctionTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/FunctionTreeItem.java @@ -17,18 +17,20 @@ package com.jpexs.decompiler.flash.action.treemodel; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class FunctionTreeItem extends TreeItem { - public List actions; + public List actions; public List constants; public String functionName; public List paramNames; - public TreeItem calculatedFunctionName; + public GraphTargetItem calculatedFunctionName; private int regStart; - public FunctionTreeItem(Action instruction, String functionName, List paramNames, List actions, List constants, int regStart) { + public FunctionTreeItem(GraphSourceItem instruction, String functionName, List paramNames, List actions, List constants, int regStart) { super(instruction, PRECEDENCE_PRIMARY); this.actions = actions; this.constants = constants; @@ -61,10 +63,10 @@ public class FunctionTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - for (TreeItem ti : actions) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + for (GraphTargetItem ti : actions) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetMemberTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetMemberTreeItem.java index 625a08c2c..ff0a0ef10 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetMemberTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetMemberTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class GetMemberTreeItem extends TreeItem { - public TreeItem object; - public TreeItem memberName; + public GraphTargetItem object; + public GraphTargetItem memberName; - public GetMemberTreeItem(Action instruction, TreeItem object, TreeItem memberName) { + public GetMemberTreeItem(GraphSourceItem instruction, GraphTargetItem object, GraphTargetItem memberName) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; this.memberName = memberName; @@ -40,10 +41,10 @@ public class GetMemberTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); - ret.addAll(memberName.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); + ret.addAll(memberName.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetPropertyTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetPropertyTreeItem.java index 1fe72becc..762b6a22d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetPropertyTreeItem.java @@ -17,14 +17,16 @@ package com.jpexs.decompiler.flash.action.treemodel; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class GetPropertyTreeItem extends TreeItem { - public TreeItem target; + public GraphTargetItem target; public int propertyIndex; - public GetPropertyTreeItem(Action instruction, TreeItem target, int propertyIndex) { + public GetPropertyTreeItem(GraphSourceItem instruction, GraphTargetItem target, int propertyIndex) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; this.propertyIndex = propertyIndex; @@ -39,9 +41,9 @@ public class GetPropertyTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(target.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(target.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURL2TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURL2TreeItem.java index b67298634..38d10a1f1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURL2TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURL2TreeItem.java @@ -16,13 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class GetURL2TreeItem extends TreeItem { - public TreeItem urlString; - public TreeItem targetString; + public GraphTargetItem urlString; + public GraphTargetItem targetString; public int method; public boolean loadTargetFlag; public boolean loadVariablesFlag; @@ -43,10 +44,10 @@ public class GetURL2TreeItem extends TreeItem { prefix = "loadMovie"; } - return hilight(prefix + "(") + urlString.toString(constants) + hilight(",") + targetString.toString(constants) + hilight(methodStr + ")") + ";"; + return hilight(prefix + "(") + urlString.toString(constants) + hilight(",") + targetString.toString(constants) + hilight(methodStr + ")"); } - public GetURL2TreeItem(Action instruction, TreeItem urlString, TreeItem targetString, int method, boolean loadTargetFlag, boolean loadVariablesFlag) { + public GetURL2TreeItem(GraphSourceItem instruction, GraphTargetItem urlString, GraphTargetItem targetString, int method, boolean loadTargetFlag, boolean loadVariablesFlag) { super(instruction, PRECEDENCE_PRIMARY); this.urlString = urlString; this.targetString = targetString; @@ -56,10 +57,10 @@ public class GetURL2TreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(urlString.getNeededActions()); - ret.addAll(targetString.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(urlString.getNeededSources()); + ret.addAll(targetString.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURLTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURLTreeItem.java index 6634a3803..808605bd2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURLTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetURLTreeItem.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.helpers.Helper; public class GetURLTreeItem extends TreeItem { @@ -25,10 +25,10 @@ public class GetURLTreeItem extends TreeItem { public String targetString; public String toString(ConstantPool constants) { - return hilight("getUrl(\"") + Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString) + hilight("\")") + ";"; + return hilight("getUrl(\"") + Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString) + hilight("\")"); } - public GetURLTreeItem(Action instruction, String urlString, String targetString) { + public GetURLTreeItem(GraphSourceItem instruction, String urlString, String targetString) { super(instruction, PRECEDENCE_PRIMARY); this.urlString = urlString; this.targetString = targetString; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetVariableTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetVariableTreeItem.java index 677a96b8b..de8c5813f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetVariableTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GetVariableTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class GetVariableTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; - public GetVariableTreeItem(Action instruction, TreeItem value) { + public GetVariableTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class GetVariableTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrame2TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrame2TreeItem.java index 73c0e5fa4..93f8ec57d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrame2TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrame2TreeItem.java @@ -16,17 +16,18 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class GotoFrame2TreeItem extends TreeItem { - public TreeItem frame; + public GraphTargetItem frame; public boolean sceneBiasFlag; public boolean playFlag; public int sceneBias; - public GotoFrame2TreeItem(Action instruction, TreeItem frame, boolean sceneBiasFlag, boolean playFlag, int sceneBias) { + public GotoFrame2TreeItem(GraphSourceItem instruction, GraphTargetItem frame, boolean sceneBiasFlag, boolean playFlag, int sceneBias) { super(instruction, PRECEDENCE_PRIMARY); this.frame = frame; this.sceneBiasFlag = sceneBiasFlag; @@ -40,13 +41,13 @@ public class GotoFrame2TreeItem extends TreeItem { if (playFlag) { prefix = "gotoAndPlay"; } - return hilight(prefix + "(") + frame.toString(constants) + (sceneBiasFlag ? "," + sceneBias : "") + hilight(")") + ";"; + return hilight(prefix + "(") + frame.toString(constants) + (sceneBiasFlag ? "," + sceneBias : "") + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(frame.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(frame.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrameTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrameTreeItem.java index 90acc3681..cac475800 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrameTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoFrameTreeItem.java @@ -16,19 +16,19 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class GotoFrameTreeItem extends TreeItem { public int frame; - public GotoFrameTreeItem(Action instruction, int frame) { + public GotoFrameTreeItem(GraphSourceItem instruction, int frame) { super(instruction, PRECEDENCE_PRIMARY); this.frame = frame; } @Override public String toString(ConstantPool constants) { - return hilight("gotoAndStop(") + frame + hilight(")") + ";"; + return hilight("gotoAndStop(") + frame + hilight(")"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoLabelTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoLabelTreeItem.java index e19fdbe3b..4cde5af15 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoLabelTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/GotoLabelTreeItem.java @@ -16,20 +16,20 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.helpers.Helper; public class GotoLabelTreeItem extends TreeItem { public String label; - public GotoLabelTreeItem(Action instruction, String label) { + public GotoLabelTreeItem(GraphSourceItem instruction, String label) { super(instruction, PRECEDENCE_PRIMARY); this.label = label; } @Override public String toString(ConstantPool constants) { - return hilight("gotoAndStop(\"") + Helper.escapeString(label) + hilight("\")") + ";"; + return hilight("gotoAndStop(\"") + Helper.escapeString(label) + hilight("\")"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ImplementsOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ImplementsOpTreeItem.java index 8011996e5..b42e1db70 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ImplementsOpTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ImplementsOpTreeItem.java @@ -16,15 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class ImplementsOpTreeItem extends TreeItem { - public TreeItem subclass; - public List superclasses; + public GraphTargetItem subclass; + public List superclasses; - public ImplementsOpTreeItem(Action instruction, TreeItem subclass, List superclasses) { + public ImplementsOpTreeItem(GraphSourceItem instruction, GraphTargetItem subclass, List superclasses) { super(instruction, PRECEDENCE_PRIMARY); this.subclass = subclass; this.superclasses = superclasses; @@ -37,17 +39,17 @@ public class ImplementsOpTreeItem extends TreeItem { if (i > 0) { impStr += ","; } - impStr += superclasses.get(i).toString(constants); + impStr += superclasses.get(i).toString(Helper.toList(constants)); } - return subclass.toString(constants) + hilight(" implements ") + impStr; + return subclass.toString(Helper.toList(constants)) + hilight(" implements ") + impStr; } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(subclass.getNeededActions()); - for (TreeItem ti : superclasses) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(subclass.getNeededSources()); + for (GraphTargetItem ti : superclasses) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/IncrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/IncrementTreeItem.java index 0de4d6200..80708bedc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/IncrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/IncrementTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class IncrementTreeItem extends TreeItem { - public TreeItem object; + public GraphTargetItem object; - public IncrementTreeItem(Action instruction, TreeItem object) { + public IncrementTreeItem(GraphSourceItem instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_ADDITIVE); this.object = object; } @@ -44,9 +45,9 @@ public class IncrementTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitArrayTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitArrayTreeItem.java index 09b4fc160..494af5633 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitArrayTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitArrayTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.IgnoredPair; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class InitArrayTreeItem extends TreeItem { - public List values; + public List values; - public InitArrayTreeItem(Action instruction, List values) { + public InitArrayTreeItem(GraphSourceItem instruction, List values) { super(instruction, PRECEDENCE_PRIMARY); this.values = values; } @@ -42,10 +43,10 @@ public class InitArrayTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - for (TreeItem value : values) { - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + for (GraphTargetItem value : values) { + ret.addAll(value.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java index 4b4ebdedc..4ed746add 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class InitObjectTreeItem extends TreeItem { - public List names; - public List values; + public List names; + public List values; - public InitObjectTreeItem(Action instruction, List names, List values) { + public InitObjectTreeItem(GraphSourceItem instruction, List names, List values) { super(instruction, PRECEDENCE_PRIMARY); this.values = values; this.names = names; @@ -43,13 +44,13 @@ public class InitObjectTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - for (TreeItem name : names) { - ret.addAll(name.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + for (GraphTargetItem name : names) { + ret.addAll(name.getNeededSources()); } - for (TreeItem value : values) { - ret.addAll(value.getNeededActions()); + for (GraphTargetItem value : values) { + ret.addAll(value.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBAsciiToCharTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBAsciiToCharTreeItem.java index 7ec5bcae4..cb0564e08 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBAsciiToCharTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBAsciiToCharTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class MBAsciiToCharTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public MBAsciiToCharTreeItem(Action instruction, TreeItem value) { + public MBAsciiToCharTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class MBAsciiToCharTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBCharToAsciiTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBCharToAsciiTreeItem.java index d7f26ad22..b13fbe314 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBCharToAsciiTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBCharToAsciiTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class MBCharToAsciiTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public MBCharToAsciiTreeItem(Action instruction, TreeItem value) { + public MBCharToAsciiTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class MBCharToAsciiTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringExtractTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringExtractTreeItem.java index 62ae77bb4..dcdae8662 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringExtractTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringExtractTreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class MBStringExtractTreeItem extends TreeItem { - public TreeItem value; - public TreeItem index; - public TreeItem count; + public GraphTargetItem value; + public GraphTargetItem index; + public GraphTargetItem count; - public MBStringExtractTreeItem(Action instruction, TreeItem value, TreeItem index, TreeItem count) { + public MBStringExtractTreeItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; this.index = index; @@ -38,11 +39,11 @@ public class MBStringExtractTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); - ret.addAll(index.getNeededActions()); - ret.addAll(count.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); + ret.addAll(index.getNeededSources()); + ret.addAll(count.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringLengthTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringLengthTreeItem.java index dfa62fc52..a0f36e8f0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringLengthTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/MBStringLengthTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class MBStringLengthTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; - public MBStringLengthTreeItem(Action instruction, TreeItem value) { + public MBStringLengthTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -38,9 +39,9 @@ public class MBStringLengthTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewMethodTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewMethodTreeItem.java index 673aa2cad..c4c43b867 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewMethodTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewMethodTreeItem.java @@ -16,17 +16,18 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.Undefined; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class NewMethodTreeItem extends TreeItem { - public TreeItem methodName; - public TreeItem scriptObject; - public List arguments; + public GraphTargetItem methodName; + public GraphTargetItem scriptObject; + public List arguments; - public NewMethodTreeItem(Action instruction, TreeItem scriptObject, TreeItem methodName, List arguments) { + public NewMethodTreeItem(GraphSourceItem instruction, GraphTargetItem scriptObject, GraphTargetItem methodName, List arguments) { super(instruction, PRECEDENCE_PRIMARY); this.methodName = methodName; this.arguments = arguments; @@ -65,12 +66,12 @@ public class NewMethodTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(methodName.getNeededActions()); - ret.addAll(scriptObject.getNeededActions()); - for (TreeItem ti : arguments) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(methodName.getNeededSources()); + ret.addAll(scriptObject.getNeededSources()); + for (GraphTargetItem ti : arguments) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewObjectTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewObjectTreeItem.java index 5c0542d03..f266baebb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewObjectTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/NewObjectTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class NewObjectTreeItem extends TreeItem { - public TreeItem objectName; - public List arguments; + public GraphTargetItem objectName; + public List arguments; - public NewObjectTreeItem(Action instruction, TreeItem objectName, List arguments) { + public NewObjectTreeItem(GraphSourceItem instruction, GraphTargetItem objectName, List arguments) { super(instruction, PRECEDENCE_PRIMARY); this.objectName = objectName; this.arguments = arguments; @@ -43,11 +44,11 @@ public class NewObjectTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(objectName.getNeededActions()); - for (TreeItem ti : arguments) { - ret.addAll(ti.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(objectName.getNeededSources()); + for (GraphTargetItem ti : arguments) { + ret.addAll(ti.getNeededSources()); } return ret; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RandomNumberTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RandomNumberTreeItem.java index aeaf63190..48c568b6a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RandomNumberTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RandomNumberTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class RandomNumberTreeItem extends TreeItem { - private TreeItem maximum; + private GraphTargetItem maximum; - public RandomNumberTreeItem(Action instruction, TreeItem maximum) { + public RandomNumberTreeItem(GraphSourceItem instruction, GraphTargetItem maximum) { super(instruction, PRECEDENCE_PRIMARY); this.maximum = maximum; } @@ -34,9 +35,9 @@ public class RandomNumberTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(maximum.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(maximum.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RemoveSpriteTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RemoveSpriteTreeItem.java index a4ba5a201..b42536448 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RemoveSpriteTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/RemoveSpriteTreeItem.java @@ -16,27 +16,28 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class RemoveSpriteTreeItem extends TreeItem { - private TreeItem target; + private GraphTargetItem target; - public RemoveSpriteTreeItem(Action instruction, TreeItem target) { + public RemoveSpriteTreeItem(GraphSourceItem instruction, GraphTargetItem target) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; } @Override public String toString(ConstantPool constants) { - return hilight("removeMovieClip(") + target.toString(constants) + hilight(")") + ";"; + return hilight("removeMovieClip(") + target.toString(constants) + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(target.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(target.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ReturnTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ReturnTreeItem.java index af33202c1..eac3d11f7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ReturnTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ReturnTreeItem.java @@ -16,27 +16,28 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class ReturnTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; - public ReturnTreeItem(Action instruction, TreeItem value) { + public ReturnTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return hilight("return ") + value.toString(constants) + ";"; + return hilight("return ") + value.toString(constants); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetMemberTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetMemberTreeItem.java index abed18458..dbddf62db 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetMemberTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetMemberTreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem { - public TreeItem object; - public TreeItem objectName; - public TreeItem value; + public GraphTargetItem object; + public GraphTargetItem objectName; + public GraphTargetItem value; - public SetMemberTreeItem(Action instruction, TreeItem object, TreeItem objectName, TreeItem value) { + public SetMemberTreeItem(GraphSourceItem instruction, GraphTargetItem object, GraphTargetItem objectName, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; this.objectName = objectName; @@ -34,20 +35,20 @@ public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem { @Override public String toString(ConstantPool constants) { - return object.toString(constants) + "." + stripQuotes(objectName) + "=" + value.toString(constants) + ";"; + return object.toString(constants) + "." + stripQuotes(objectName) + "=" + value.toString(constants); } @Override public TreeItem getObject() { - return new GetMemberTreeItem(instruction, object, objectName); + return new GetMemberTreeItem(src, object, objectName); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); - ret.addAll(objectName.getNeededActions()); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); + ret.addAll(objectName.getNeededSources()); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetPropertyTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetPropertyTreeItem.java index f337fa680..e54235881 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetPropertyTreeItem.java @@ -17,15 +17,17 @@ package com.jpexs.decompiler.flash.action.treemodel; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class SetPropertyTreeItem extends TreeItem implements SetTypeTreeItem { - public TreeItem target; + public GraphTargetItem target; public int propertyIndex; - public TreeItem value; + public GraphTargetItem value; - public SetPropertyTreeItem(Action instruction, TreeItem target, int propertyIndex, TreeItem value) { + public SetPropertyTreeItem(GraphSourceItem instruction, GraphTargetItem target, int propertyIndex, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; this.propertyIndex = propertyIndex; @@ -35,21 +37,21 @@ public class SetPropertyTreeItem extends TreeItem implements SetTypeTreeItem { @Override public String toString(ConstantPool constants) { if (isEmptyString(target)) { - return hilight(Action.propertyNames[propertyIndex] + "=") + value.toString(constants) + ";"; + return hilight(Action.propertyNames[propertyIndex] + "=") + value.toString(constants); } - return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex] + "=") + value.toString(constants) + ";"; + return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex] + "=") + value.toString(constants); } @Override public TreeItem getObject() { - return new GetPropertyTreeItem(instruction, target, propertyIndex); + return new GetPropertyTreeItem(src, target, propertyIndex); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(target.getNeededActions()); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(target.getNeededSources()); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTarget2TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTarget2TreeItem.java index 0a067428c..5688cece2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTarget2TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTarget2TreeItem.java @@ -16,27 +16,28 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class SetTarget2TreeItem extends TreeItem { - public TreeItem target; + public GraphTargetItem target; - public SetTarget2TreeItem(Action instruction, TreeItem target) { + public SetTarget2TreeItem(GraphSourceItem instruction, GraphTargetItem target) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; } @Override public String toString(ConstantPool constants) { - return hilight("tellTarget(") + target.toString(constants) + hilight(")") + ";"; + return hilight("tellTarget(") + target.toString(constants) + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(target.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(target.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTargetTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTargetTreeItem.java index 3af6de0e7..e9cd0fab8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTargetTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetTargetTreeItem.java @@ -16,20 +16,20 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.helpers.Helper; public class SetTargetTreeItem extends TreeItem { public String target; - public SetTargetTreeItem(Action instruction, String target) { + public SetTargetTreeItem(GraphSourceItem instruction, String target) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; } @Override public String toString(ConstantPool constants) { - return hilight("tellTarget(\"") + Helper.escapeString(target) + hilight("\")") + ";"; + return hilight("tellTarget(\"") + Helper.escapeString(target) + hilight("\")"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetVariableTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetVariableTreeItem.java index 644a97eea..5a00acad9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetVariableTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SetVariableTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class SetVariableTreeItem extends TreeItem implements SetTypeTreeItem { - public TreeItem name; - public TreeItem value; + public GraphTargetItem name; + public GraphTargetItem value; - public SetVariableTreeItem(Action instruction, TreeItem name, TreeItem value) { + public SetVariableTreeItem(GraphSourceItem instruction, GraphTargetItem name, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.name = name; this.value = value; @@ -32,19 +33,19 @@ public class SetVariableTreeItem extends TreeItem implements SetTypeTreeItem { @Override public String toString(ConstantPool constants) { - return stripQuotes(name) + hilight("=") + value.toString(constants) + ";"; + return stripQuotes(name) + hilight("=") + value.toString(constants); } @Override public TreeItem getObject() { - return new GetVariableTreeItem(instruction, value); + return new GetVariableTreeItem(src, value); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(name.getNeededActions()); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(name.getNeededSources()); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SimpleActionTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SimpleActionTreeItem.java index 94b144c24..ff00d4808 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SimpleActionTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/SimpleActionTreeItem.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class SimpleActionTreeItem extends TreeItem { @@ -27,7 +27,7 @@ public class SimpleActionTreeItem extends TreeItem { return hilight(actionString); } - public SimpleActionTreeItem(Action instruction, String actionString) { + public SimpleActionTreeItem(GraphSourceItem instruction, String actionString) { super(instruction, PRECEDENCE_PRIMARY); this.actionString = actionString; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StartDragTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StartDragTreeItem.java index cd446591c..4f418f8bd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StartDragTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StartDragTreeItem.java @@ -16,20 +16,21 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class StartDragTreeItem extends TreeItem { - public TreeItem target; - public TreeItem lockCenter; - public TreeItem constrain; - public TreeItem y2; - public TreeItem x2; - public TreeItem y1; - public TreeItem x1; + public GraphTargetItem target; + public GraphTargetItem lockCenter; + public GraphTargetItem constrain; + public GraphTargetItem y2; + public GraphTargetItem x2; + public GraphTargetItem y1; + public GraphTargetItem x1; - public StartDragTreeItem(Action instruction, TreeItem target, TreeItem lockCenter, TreeItem constrain, TreeItem x1, TreeItem y1, TreeItem x2, TreeItem y2) { + public StartDragTreeItem(GraphSourceItem instruction, GraphTargetItem target, GraphTargetItem lockCenter, GraphTargetItem constrain, GraphTargetItem x1, GraphTargetItem y1, GraphTargetItem x2, GraphTargetItem y2) { super(instruction, PRECEDENCE_PRIMARY); this.target = target; this.lockCenter = lockCenter; @@ -59,14 +60,14 @@ public class StartDragTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(target.getNeededActions()); - ret.addAll(constrain.getNeededActions()); - ret.addAll(x1.getNeededActions()); - ret.addAll(x2.getNeededActions()); - ret.addAll(y1.getNeededActions()); - ret.addAll(y2.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(target.getNeededSources()); + ret.addAll(constrain.getNeededSources()); + ret.addAll(x1.getNeededSources()); + ret.addAll(x2.getNeededSources()); + ret.addAll(y1.getNeededSources()); + ret.addAll(y2.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StoreRegisterTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StoreRegisterTreeItem.java index 9e37e45fc..a75c2548f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StoreRegisterTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StoreRegisterTreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class StoreRegisterTreeItem extends TreeItem implements SetTypeTreeItem { public RegisterNumber register; - public TreeItem value; + public GraphTargetItem value; - public StoreRegisterTreeItem(Action instruction, RegisterNumber register, TreeItem value) { + public StoreRegisterTreeItem(GraphSourceItem instruction, RegisterNumber register, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; this.register = register; @@ -33,18 +34,18 @@ public class StoreRegisterTreeItem extends TreeItem implements SetTypeTreeItem { @Override public String toString(ConstantPool constants) { - return hilight(register.toString() + "=") + value.toString(constants) + ";"; + return hilight(register.toString() + "=") + value.toString(constants); } @Override public TreeItem getObject() { - return new DirectValueTreeItem(instruction, -1, register, null); + return new DirectValueTreeItem(src, -1, register, null); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StrictModeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StrictModeTreeItem.java index 4f143006d..460e110d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StrictModeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StrictModeTreeItem.java @@ -16,13 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class StrictModeTreeItem extends TreeItem { public int mode; - public StrictModeTreeItem(Action instruction, int mode) { + public StrictModeTreeItem(GraphSourceItem instruction, int mode) { super(instruction, PRECEDENCE_PRIMARY); this.mode = mode; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StringExtractTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StringExtractTreeItem.java index 0b5641ee5..3ef6742da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StringExtractTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/StringExtractTreeItem.java @@ -16,16 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class StringExtractTreeItem extends TreeItem { - public TreeItem value; - public TreeItem index; - public TreeItem count; + public GraphTargetItem value; + public GraphTargetItem index; + public GraphTargetItem count; - public StringExtractTreeItem(Action instruction, TreeItem value, TreeItem index, TreeItem count) { + public StringExtractTreeItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; this.index = index; @@ -38,11 +39,11 @@ public class StringExtractTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); - ret.addAll(index.getNeededActions()); - ret.addAll(count.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); + ret.addAll(index.getNeededSources()); + ret.addAll(count.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TargetPathTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TargetPathTreeItem.java index 755fd466e..5f1636fba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TargetPathTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TargetPathTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class TargetPathTreeItem extends TreeItem { - public TreeItem object; + public GraphTargetItem object; - public TargetPathTreeItem(Action instruction, TreeItem object) { + public TargetPathTreeItem(GraphSourceItem instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; } @@ -34,9 +35,9 @@ public class TargetPathTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ThrowTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ThrowTreeItem.java index 694597950..9c12a85b4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ThrowTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ThrowTreeItem.java @@ -16,27 +16,30 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class ThrowTreeItem extends TreeItem { - public TreeItem object; + public GraphTargetItem object; - public ThrowTreeItem(Action instruction, TreeItem object) { + public ThrowTreeItem(GraphSourceItem instruction, GraphTargetItem object) { super(instruction, PRECEDENCE_PRIMARY); this.object = object; } @Override public String toString(ConstantPool constants) { - return hilight("throw ") + object.toString(constants) + ";"; + return hilight("throw ") + object.toString(Helper.toList(constants)); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(object.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(object.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToIntegerTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToIntegerTreeItem.java index 585f4ae14..cb3128207 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToIntegerTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToIntegerTreeItem.java @@ -16,14 +16,15 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class ToIntegerTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public ToIntegerTreeItem(Action instruction, TreeItem value) { + public ToIntegerTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @@ -34,9 +35,9 @@ public class ToIntegerTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToNumberTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToNumberTreeItem.java index d8428e4b2..abf1d704c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToNumberTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToNumberTreeItem.java @@ -16,27 +16,29 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class ToNumberTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public ToNumberTreeItem(Action instruction, TreeItem value) { + public ToNumberTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return value.toString(constants) + hilight(".valueOf()"); + return value.toString(Helper.toList(constants)) + hilight(".valueOf()"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToStringTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToStringTreeItem.java index 1468815f2..98d3a6304 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToStringTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/ToStringTreeItem.java @@ -16,27 +16,29 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class ToStringTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public ToStringTreeItem(Action instruction, TreeItem value) { + public ToStringTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return value.toString(constants) + hilight(".toString()"); + return value.toString(Helper.toList(constants)) + hilight(".toString()"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TraceTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TraceTreeItem.java index bd4d588c2..c37589269 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TraceTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TraceTreeItem.java @@ -16,27 +16,28 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class TraceTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public TraceTreeItem(Action instruction, TreeItem value) { + public TraceTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return hilight("trace(") + value.toString(constants) + hilight(")") + ";"; + return hilight("trace(") + value.toString(constants) + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TreeItem.java index 7022bd87f..e9acfb80f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TreeItem.java @@ -16,68 +16,30 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.IgnoredPair; -import com.jpexs.decompiler.flash.helpers.Highlighting; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; -public abstract class TreeItem { +public abstract class TreeItem extends GraphTargetItem { - public static final int PRECEDENCE_PRIMARY = 0; - public static final int PRECEDENCE_POSTFIX = 1; - public static final int PRECEDENCE_UNARY = 2; - public static final int PRECEDENCE_MULTIPLICATIVE = 3; - public static final int PRECEDENCE_ADDITIVE = 4; - public static final int PRECEDENCE_BITWISESHIFT = 5; - public static final int PRECEDENCE_RELATIONAL = 6; - public static final int PRECEDENCE_EQUALITY = 7; - public static final int PRECEDENCE_BITWISEAND = 8; - public static final int PRECEDENCE_BITWISEXOR = 9; - public static final int PRECEDENCE_BITWISEOR = 10; - public static final int PRECEDENCE_LOGICALAND = 11; - public static final int PRECEDENCE_LOGICALOR = 12; - public static final int PRECEDENCE_CONDITIONAL = 13; - public static final int PRECEDENCE_ASSIGMENT = 14; - public static final int PRECEDENCE_COMMA = 15; - public static final int NOPRECEDENCE = 16; - public int precedence = NOPRECEDENCE; - public Action instruction; public int instructionPos = 0; - public List moreInstructions = new ArrayList(); + public List moreInstructions = new ArrayList(); - public TreeItem(Action instruction, int precedence) { - this.instruction = instruction; - this.precedence = precedence; + public TreeItem(GraphSourceItem instruction, int precedence) { + super(instruction, precedence); } public abstract String toString(ConstantPool constants); - public String toStringNoQuotes(ConstantPool constants) { - return toString(constants); - } - @Override public String toString() { - return toString(null); + ConstantPool c = null; + return toString(c); } - protected String hilight(String str) { - if (instruction == null) { - return str; - } - return Highlighting.hilighOffset(str, instruction.getAddress()); - } - - public boolean isFalse() { - return false; - } - - public boolean isTrue() { - return false; - } - - protected boolean isEmptyString(TreeItem target) { + protected boolean isEmptyString(GraphTargetItem target) { if (target instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) target).value instanceof String) { @@ -89,7 +51,7 @@ public abstract class TreeItem { return false; } - protected String stripQuotes(TreeItem target) { + protected String stripQuotes(GraphTargetItem target) { if (target instanceof DirectValueTreeItem) { if (((DirectValueTreeItem) target).value instanceof String) { return (String) ((DirectValueTreeItem) target).hilight((String) ((DirectValueTreeItem) target).value); @@ -102,24 +64,17 @@ public abstract class TreeItem { } } - public boolean isCompileTime() { - return false; + @Override + public List getNeededSources() { + return getNeededSources(); } - public double toNumber() { - return 0; - } - - public boolean toBoolean() { - return Double.compare(toNumber(), 0.0) != 0; - } - - public List getNeededActions() { - List ret = new ArrayList(); - if (instruction != null) { - ret.add(new IgnoredPair(instruction, instructionPos)); + @Override + public String toString(List localData) { + if (localData.isEmpty()) { + ConstantPool c = null; + return toString(c); } - ret.addAll(moreInstructions); - return ret; + return toString((ConstantPool) localData.get(0)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TypeOfTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TypeOfTreeItem.java index db52323e1..199a901e1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TypeOfTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/TypeOfTreeItem.java @@ -16,27 +16,29 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; public class TypeOfTreeItem extends TreeItem { - private TreeItem value; + private GraphTargetItem value; - public TypeOfTreeItem(Action instruction, TreeItem value) { + public TypeOfTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return hilight("typeof(") + value.toString(constants) + hilight(")"); + return hilight("typeof(") + value.toString(Helper.toList(constants)) + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/UnsupportedTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/UnsupportedTreeItem.java index f88463175..ba3259b18 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/UnsupportedTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/UnsupportedTreeItem.java @@ -16,19 +16,19 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class UnsupportedTreeItem extends TreeItem { public String value; - public UnsupportedTreeItem(Action instruction, String value) { + public UnsupportedTreeItem(GraphSourceItem instruction, String value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return "//Unsupported by decompiler:" + value + ";"; + return "//Unsupported by decompiler:" + value; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/VoidTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/VoidTreeItem.java index e610b8a45..0b5315b0b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/VoidTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/VoidTreeItem.java @@ -16,19 +16,19 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class VoidTreeItem extends TreeItem { public TreeItem value; - public VoidTreeItem(Action instruction, TreeItem value) { + public VoidTreeItem(GraphSourceItem instruction, TreeItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } @Override public String toString(ConstantPool constants) { - return value.toString(constants) + ";"; + return value.toString(constants); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrame2TreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrame2TreeItem.java index 2aa7cd386..6da450c65 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrame2TreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrame2TreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public class WaitForFrame2TreeItem extends TreeItem { - public TreeItem frame; + public GraphTargetItem frame; public int skipCount; - public WaitForFrame2TreeItem(Action instruction, TreeItem frame, int skipCount) { + public WaitForFrame2TreeItem(GraphSourceItem instruction, GraphTargetItem frame, int skipCount) { super(instruction, PRECEDENCE_PRIMARY); this.frame = frame; this.skipCount = skipCount; @@ -32,13 +33,13 @@ public class WaitForFrame2TreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return hilight("waitForFrame2(") + frame.toString(constants) + "," + skipCount + hilight(")") + ";"; + return hilight("waitForFrame2(") + frame.toString(constants) + "," + skipCount + hilight(")"); } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(frame.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(frame.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrameTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrameTreeItem.java index 5611592f2..abf658ba8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrameTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/WaitForFrameTreeItem.java @@ -16,14 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel; -import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class WaitForFrameTreeItem extends TreeItem { public int frame; public int skipCount; - public WaitForFrameTreeItem(Action instruction, int frame, int skipCount) { + public WaitForFrameTreeItem(GraphSourceItem instruction, int frame, int skipCount) { super(instruction, PRECEDENCE_PRIMARY); this.frame = frame; this.skipCount = skipCount; @@ -31,6 +31,6 @@ public class WaitForFrameTreeItem extends TreeItem { @Override public String toString(ConstantPool constants) { - return hilight("waitForFrame(") + frame + "," + skipCount + hilight(")") + ";"; + return hilight("waitForFrame(") + frame + "," + skipCount + hilight(")"); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ClassTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ClassTreeItem.java index b4024083a..df0e5ccd6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ClassTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ClassTreeItem.java @@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.helpers.Helper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,13 +32,13 @@ public class ClassTreeItem extends TreeItem implements Block { public List functions; public List staticFunctions; - public TreeItem extendsOp; - public List implementsOp; - public TreeItem className; - public HashMap vars; - public HashMap staticVars; + public GraphTargetItem extendsOp; + public List implementsOp; + public GraphTargetItem className; + public HashMap vars; + public HashMap staticVars; - public ClassTreeItem(TreeItem className, TreeItem extendsOp, List implementsOp, List functions, HashMap vars, List staticFunctions, HashMap staticVars) { + public ClassTreeItem(GraphTargetItem className, GraphTargetItem extendsOp, List implementsOp, List functions, HashMap vars, List staticFunctions, HashMap staticVars) { super(null, NOPRECEDENCE); this.className = className; this.functions = functions; @@ -49,14 +52,14 @@ public class ClassTreeItem extends TreeItem implements Block { @Override public String toString(ConstantPool constants) { String ret; - ret = hilight("class ") + className.toStringNoQuotes(constants); + ret = hilight("class ") + className.toStringNoQuotes(Helper.toList(constants)); if (extendsOp != null) { - ret += hilight(" extends ") + extendsOp.toStringNoQuotes(constants); + ret += hilight(" extends ") + extendsOp.toStringNoQuotes(Helper.toList(constants)); } if (!implementsOp.isEmpty()) { ret += hilight(" implements "); boolean first = true; - for (TreeItem t : implementsOp) { + for (GraphTargetItem t : implementsOp) { if (!first) { ret += ", "; } @@ -71,10 +74,10 @@ public class ClassTreeItem extends TreeItem implements Block { for (FunctionTreeItem f : staticFunctions) { ret += "static " + f.toString(constants) + "\r\n"; } - for (TreeItem v : vars.keySet()) { + for (GraphTargetItem v : vars.keySet()) { ret += "var " + v.toStringNoQuotes(constants) + " = " + vars.get(v).toStringNoQuotes(constants) + ";\r\n"; } - for (TreeItem v : staticVars.keySet()) { + for (GraphTargetItem v : staticVars.keySet()) { ret += "static var " + v.toStringNoQuotes(constants) + " = " + staticVars.get(v).toStringNoQuotes(constants) + ";\r\n"; } ret += "}\r\n"; @@ -82,8 +85,8 @@ public class ClassTreeItem extends TreeItem implements Block { } @Override - public List getContinues() { - List ret = new ArrayList(); + public List getContinues() { + List ret = new ArrayList(); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/DoWhileTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/DoWhileTreeItem.java deleted file mode 100644 index bb9fe79eb..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/DoWhileTreeItem.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.List; - -public class DoWhileTreeItem extends LoopTreeItem implements Block { - - public List commands; - public TreeItem expression; - - public DoWhileTreeItem(Action instruction, int loopBreak, int loopContinue, List commands, TreeItem expression) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("do\r\n{") + "\r\n"; - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}\r\nwhile(") + expression.toString(constants) + hilight(");") + "\r\n"; - ret += ":loop" + loopBreak; - - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForEachTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForEachTreeItem.java index 76c11f2ad..2f46a5d8a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForEachTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForEachTreeItem.java @@ -18,9 +18,12 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.EachTreeItem; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.Loop; import java.util.ArrayList; import java.util.List; @@ -29,8 +32,8 @@ public class ForEachTreeItem extends LoopTreeItem implements Block { public EachTreeItem expression; public List commands; - public ForEachTreeItem(Action instruction, int loopBreak, int loopContinue, EachTreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); + public ForEachTreeItem(Action instruction, Loop loop, EachTreeItem expression, List commands) { + super(instruction, loop); this.expression = expression; this.commands = commands; } @@ -38,21 +41,22 @@ public class ForEachTreeItem extends LoopTreeItem implements Block { @Override public String toString(ConstantPool constants) { String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; + ret += "loop" + loop.id + ":\r\n"; ret += hilight("for ") + expression.toString(constants) + "\r\n{\r\n"; for (TreeItem ti : commands) { ret += ti.toString(constants) + "\r\n"; } ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; + ret += ":loop" + loop.id; return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForInTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForInTreeItem.java index c4f0e375f..061efb282 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForInTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForInTreeItem.java @@ -18,8 +18,11 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.Loop; import java.util.ArrayList; import java.util.List; @@ -29,8 +32,8 @@ public class ForInTreeItem extends LoopTreeItem implements Block { public TreeItem enumVariable; public List commands; - public ForInTreeItem(Action instruction, int loopBreak, int loopContinue, TreeItem variableName, TreeItem enumVariable, List commands) { - super(instruction, loopBreak, loopContinue); + public ForInTreeItem(Action instruction, Loop loop, TreeItem variableName, TreeItem enumVariable, List commands) { + super(instruction, loop); this.variableName = variableName; this.enumVariable = enumVariable; this.commands = commands; @@ -39,21 +42,22 @@ public class ForInTreeItem extends LoopTreeItem implements Block { @Override public String toString(ConstantPool constants) { String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; + ret += "loop" + loop.id + ":\r\n"; ret += hilight("for(") + stripQuotes(variableName) + " in " + enumVariable.toString(constants) + ")\r\n{\r\n"; for (TreeItem ti : commands) { ret += ti.toString(constants) + "\r\n"; } ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; + ret += ":loop" + loop.id; return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForTreeItem.java deleted file mode 100644 index 7758e657c..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/ForTreeItem.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.List; - -public class ForTreeItem extends LoopTreeItem implements Block { - - public List firstCommands; - public TreeItem expression; - public List finalCommands; - public List commands; - - public ForTreeItem(Action instruction, long loopBreak, long loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { - super(instruction, loopBreak, loopContinue); - this.firstCommands = firstCommands; - this.expression = expression; - this.finalCommands = finalCommands; - this.commands = commands; - - if ((!commands.isEmpty()) && (commands.get(commands.size() - 1) instanceof ContinueTreeItem)) { - if (((ContinueTreeItem) commands.get(commands.size() - 1)).loopPos == loopBreak) { - commands.remove(commands.size() - 1); - } - } - } - - private String stripSemicolon(String s) { - if (s.endsWith(";")) { - s = s.substring(0, s.length() - 1); - } - return s; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("for("); - for (int i = 0; i < firstCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(firstCommands.get(i).toString(constants)); - } - ret += ";"; - ret += expression.toString(constants); - ret += ";"; - for (int i = 0; i < finalCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(finalCommands.get(i).toString(constants)); - } - ret += hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/IfTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/IfTreeItem.java deleted file mode 100644 index fe1c404f9..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/IfTreeItem.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.List; - -public class IfTreeItem extends TreeItem implements Block { - - public TreeItem expression; - public List onTrue; - public List onFalse; - - public IfTreeItem(Action instruction, TreeItem expression, List onTrue, List onFalse) { - super(instruction, NOPRECEDENCE); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - String ret; - ret = hilight("if(") + expression.toString(constants) + hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : onTrue) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - if (onFalse.size() > 0) { - ret += hilight("\r\nelse\r\n{\r\n"); - for (TreeItem ti : onFalse) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - } - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : onTrue) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - for (TreeItem ti : onFalse) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/InterfaceTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/InterfaceTreeItem.java index 16a13182b..cc588c3d5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/InterfaceTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/InterfaceTreeItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; /** @@ -27,10 +28,10 @@ import java.util.List; */ public class InterfaceTreeItem extends TreeItem { - public TreeItem name; - public List superInterfaces; + public GraphTargetItem name; + public List superInterfaces; - public InterfaceTreeItem(TreeItem name, List superInterfaces) { + public InterfaceTreeItem(GraphTargetItem name, List superInterfaces) { super(null, NOPRECEDENCE); this.name = name; this.superInterfaces = superInterfaces; @@ -44,7 +45,7 @@ public class InterfaceTreeItem extends TreeItem { if (!superInterfaces.isEmpty()) { ret += " extends "; } - for (TreeItem ti : superInterfaces) { + for (GraphTargetItem ti : superInterfaces) { if (!first) { ret += ", "; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/LoopTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/LoopTreeItem.java index 4d1b78094..fb406e711 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/LoopTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/LoopTreeItem.java @@ -18,15 +18,14 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.Loop; public abstract class LoopTreeItem extends TreeItem { - public long loopBreak; - public long loopContinue; + public Loop loop; - public LoopTreeItem(Action instruction, long loopBreak, long loopContinue) { + public LoopTreeItem(Action instruction, Loop loop) { super(instruction, NOPRECEDENCE); - this.loopBreak = loopBreak; - this.loopContinue = loopContinue; + this.loop = loop; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TryTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TryTreeItem.java index d7e6a3bf1..84b2ed9d0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TryTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TryTreeItem.java @@ -17,19 +17,21 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.Block; +import com.jpexs.decompiler.flash.graph.ContinueItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; public class TryTreeItem extends TreeItem implements Block { - public List tryCommands; - public List catchExceptions; - public List> catchCommands; - public List finallyCommands; + public List tryCommands; + public List catchExceptions; + public List> catchCommands; + public List finallyCommands; - public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { + public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { super(null, NOPRECEDENCE); this.tryCommands = tryCommands; this.catchExceptions = catchExceptions; @@ -41,52 +43,55 @@ public class TryTreeItem extends TreeItem implements Block { public String toString(ConstantPool constants) { String ret = ""; ret += "try\r\n{\r\n"; - for (TreeItem ti : tryCommands) { - ret += ti.toString(constants) + "\r\n"; + List localData = new ArrayList(); + localData.add(constants); + for (GraphTargetItem ti : tryCommands) { + ret += ti.toString(localData) + "\r\n"; } ret += "}"; for (int e = 0; e < catchExceptions.size(); e++) { - ret += "\r\ncatch(" + catchExceptions.get(e).toString(constants) + ")\r\n{\r\n"; - List commands = catchCommands.get(e); - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; + ret += "\r\ncatch(" + catchExceptions.get(e).toString(localData) + ")\r\n{\r\n"; + List commands = catchCommands.get(e); + for (GraphTargetItem ti : commands) { + ret += ti.toString(localData) + "\r\n"; } ret += "}"; } if (finallyCommands.size() > 0) { ret += "\r\nfinally\r\n{\r\n"; - for (TreeItem ti : finallyCommands) { - ret += ti.toString(constants) + "\r\n"; + for (GraphTargetItem ti : finallyCommands) { + ret += ti.toString(localData) + "\r\n"; } ret += "}"; } return ret; } - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : tryCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : tryCommands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); } } if (finallyCommands != null) { - for (TreeItem ti : finallyCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (GraphTargetItem ti : finallyCommands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); } } } - for (List commands : catchCommands) { - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (List commands : catchCommands) { + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WhileTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WhileTreeItem.java deleted file mode 100644 index 6dbbe9bdf..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WhileTreeItem.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import java.util.ArrayList; -import java.util.List; - -public class WhileTreeItem extends LoopTreeItem implements Block { - - public TreeItem expression; - public List commands; - - public WhileTreeItem(Action instruction, long loopBreak, long loopContinue, TreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - - if ((!commands.isEmpty()) && (commands.get(commands.size() - 1) instanceof ContinueTreeItem)) { - if (((ContinueTreeItem) commands.get(commands.size() - 1)).loopPos == loopBreak) { - commands.remove(commands.size() - 1); - } - } - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("while(") + expression.toString(constants) + hilight(")") + "\r\n{\r\n"; - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WithTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WithTreeItem.java index 3a08c884d..2a92ade1f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WithTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/WithTreeItem.java @@ -19,15 +19,16 @@ package com.jpexs.decompiler.flash.action.treemodel.clauses; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.ArrayList; import java.util.List; public class WithTreeItem extends TreeItem { - public TreeItem scope; - public List items; + public GraphTargetItem scope; + public List items; - public WithTreeItem(Action instruction, TreeItem scope, List items) { + public WithTreeItem(Action instruction, GraphTargetItem scope, List items) { super(instruction, NOPRECEDENCE); this.scope = scope; this.items = items; @@ -36,15 +37,17 @@ public class WithTreeItem extends TreeItem { public WithTreeItem(Action instruction, TreeItem scope) { super(instruction, NOPRECEDENCE); this.scope = scope; - this.items = new ArrayList(); + this.items = new ArrayList(); } @Override public String toString(ConstantPool constants) { String ret; - ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n"); - for (TreeItem ti : items) { - ret += ti.toString(constants) + "\r\n"; + List localData = new ArrayList(); + localData.add(constants); + ret = hilight("with(") + scope.toString(localData) + hilight(")\r\n{\r\n"); + for (GraphTargetItem ti : items) { + ret += ti.toString(localData) + "\r\n"; } ret += hilight("}"); return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AddTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AddTreeItem.java index 9e9816506..8f7eee542 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AddTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AddTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class AddTreeItem extends BinaryOpTreeItem { +public class AddTreeItem extends BinaryOpItem { - public AddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public AddTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AndTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AndTreeItem.java index e9498bd37..7453704e7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AndTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AndTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class AndTreeItem extends BinaryOpTreeItem { +public class AndTreeItem extends BinaryOpItem { - public AndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public AndTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AsTypeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AsTypeTreeItem.java index b39e37476..0e9467db2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AsTypeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/AsTypeTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; -public class AsTypeTreeItem extends BinaryOpTreeItem { +public class AsTypeTreeItem extends BinaryOpItem { - public AsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { + public AsTypeTreeItem(GraphSourceItem instruction, TreeItem value, TreeItem type) { super(instruction, PRECEDENCE_RELATIONAL, value, type, " as "); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BinaryOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BinaryOpTreeItem.java deleted file mode 100644 index 43be4054d..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BinaryOpTreeItem.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.operations; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; -import java.util.List; - -public abstract class BinaryOpTreeItem extends TreeItem { - - public TreeItem leftSide; - public TreeItem rightSide; - protected String operator = ""; - - public BinaryOpTreeItem(Action instruction, int precedence, TreeItem leftSide, TreeItem rightSide, String operator) { - super(instruction, precedence); - this.leftSide = leftSide; - this.rightSide = rightSide; - this.operator = operator; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - if (leftSide.precedence > precedence) { - ret += "(" + leftSide.toString(constants) + ")"; - } else { - ret += leftSide.toString(constants); - } - ret += hilight(operator); - if (rightSide.precedence > precedence) { - ret += "(" + rightSide.toString(constants) + ")"; - } else { - ret += rightSide.toString(constants); - } - return ret; - } - - @Override - public boolean isCompileTime() { - return leftSide.isCompileTime() && rightSide.isCompileTime(); - } - - @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(leftSide.getNeededActions()); - ret.addAll(rightSide.getNeededActions()); - return ret; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitAndTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitAndTreeItem.java index 6941812d7..bb762f7af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitAndTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitAndTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class BitAndTreeItem extends BinaryOpTreeItem { +public class BitAndTreeItem extends BinaryOpItem { - public BitAndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public BitAndTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitNotTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitNotTreeItem.java index 898e55743..4b4b54c06 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitNotTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitNotTreeItem.java @@ -16,12 +16,12 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class BitNotTreeItem extends UnaryOpTreeItem { - public BitNotTreeItem(Action instruction, TreeItem value) { + public BitNotTreeItem(GraphSourceItem instruction, TreeItem value) { super(instruction, PRECEDENCE_UNARY, value, "~"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitOrTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitOrTreeItem.java index 8a79ecded..736adc34f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitOrTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitOrTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class BitOrTreeItem extends BinaryOpTreeItem { +public class BitOrTreeItem extends BinaryOpItem { - public BitOrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public BitOrTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitXorTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitXorTreeItem.java index 95cf4b68d..5625e9012 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitXorTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/BitXorTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class BitXorTreeItem extends BinaryOpTreeItem { +public class BitXorTreeItem extends BinaryOpItem { - public BitXorTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public BitXorTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/DivideTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/DivideTreeItem.java index ea77b7d21..70bee2355 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/DivideTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/DivideTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class DivideTreeItem extends BinaryOpTreeItem { +public class DivideTreeItem extends BinaryOpItem { - public DivideTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public DivideTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/EqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/EqTreeItem.java index 3ce8ec72c..3d4ad82e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/EqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/EqTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class EqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class EqTreeItem extends BinaryOpItem implements LogicalOpItem { - public EqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public EqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); } @@ -31,7 +33,7 @@ public class EqTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new NeqTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new NeqTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GeTreeItem.java index 146c15801..daecbf553 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GeTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class GeTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class GeTreeItem extends BinaryOpItem implements LogicalOpItem { - public GeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public GeTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); } @@ -31,7 +33,7 @@ public class GeTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new LtTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new LtTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GtTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GtTreeItem.java index 0c5a65b75..df3d7919a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GtTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/GtTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class GtTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class GtTreeItem extends BinaryOpItem implements LogicalOpItem { - public GtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public GtTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); } @@ -31,7 +33,7 @@ public class GtTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new LeTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new LeTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InTreeItem.java index b106dae89..4ccc7c84a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; -public class InTreeItem extends BinaryOpTreeItem { +public class InTreeItem extends BinaryOpItem { - public InTreeItem(Action instruction, TreeItem name, TreeItem object) { + public InTreeItem(GraphSourceItem instruction, TreeItem name, TreeItem object) { super(instruction, PRECEDENCE_RELATIONAL, name, object, " in "); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InstanceOfTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InstanceOfTreeItem.java index b1d38661e..e47e7e762 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InstanceOfTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/InstanceOfTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class InstanceOfTreeItem extends BinaryOpTreeItem { +public class InstanceOfTreeItem extends BinaryOpItem { - public InstanceOfTreeItem(Action instruction, TreeItem value, TreeItem type) { + public InstanceOfTreeItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem type) { super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof "); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/IsTypeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/IsTypeTreeItem.java index 5bd428a13..45c4f0e4b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/IsTypeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/IsTypeTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; -public class IsTypeTreeItem extends BinaryOpTreeItem { +public class IsTypeTreeItem extends BinaryOpItem { - public IsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { + public IsTypeTreeItem(GraphSourceItem instruction, TreeItem value, TreeItem type) { super(instruction, PRECEDENCE_RELATIONAL, value, type, " is "); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LShiftTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LShiftTreeItem.java index 9745a0f04..7b01d0e5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LShiftTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LShiftTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class LShiftTreeItem extends BinaryOpTreeItem { +public class LShiftTreeItem extends BinaryOpItem { - public LShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public LShiftTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LeTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LeTreeItem.java index 78289306d..d70b4be55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LeTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LeTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class LeTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class LeTreeItem extends BinaryOpItem implements LogicalOpItem { - public LeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public LeTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); } @@ -31,7 +33,7 @@ public class LeTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new GtTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new GtTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LtTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LtTreeItem.java index fb92d9c30..65b3d5d98 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LtTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LtTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class LtTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class LtTreeItem extends BinaryOpItem implements LogicalOpItem { - public LtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public LtTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); } @@ -31,7 +33,7 @@ public class LtTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new GeTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new GeTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/ModuloTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/ModuloTreeItem.java index 905f59702..590391d21 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/ModuloTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/ModuloTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class ModuloTreeItem extends BinaryOpTreeItem { +public class ModuloTreeItem extends BinaryOpItem { - public ModuloTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public ModuloTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/MultiplyTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/MultiplyTreeItem.java index 4fd610074..e8b2495cb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/MultiplyTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/MultiplyTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class MultiplyTreeItem extends BinaryOpTreeItem { +public class MultiplyTreeItem extends BinaryOpItem { - public MultiplyTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public MultiplyTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NegTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NegTreeItem.java index 258dc15df..f9513ecfe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NegTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NegTreeItem.java @@ -16,12 +16,12 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class NegTreeItem extends UnaryOpTreeItem { - public NegTreeItem(Action instruction, TreeItem value) { + public NegTreeItem(GraphSourceItem instruction, TreeItem value) { super(instruction, PRECEDENCE_UNARY, value, "-"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NeqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NeqTreeItem.java index e7c2985e2..bfa655d8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NeqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NeqTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class NeqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class NeqTreeItem extends BinaryOpItem implements LogicalOpItem { - public NeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public NeqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); } @@ -31,7 +33,7 @@ public class NeqTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new EqTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new EqTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NotTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NotTreeItem.java index e3bcab5b1..5f75a5553 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NotTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/NotTreeItem.java @@ -16,25 +16,17 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; +import com.jpexs.decompiler.flash.graph.NotItem; -public class NotTreeItem extends UnaryOpTreeItem implements LogicalOp { +public class NotTreeItem extends UnaryOpTreeItem implements LogicalOpItem, NotItem { - public NotTreeItem(Action instruction, TreeItem value) { + public NotTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_UNARY, value, "!"); } - @Override - public boolean isTrue() { - return !value.isTrue(); - } - - @Override - public boolean isFalse() { - return !value.isFalse(); - } - @Override public boolean toBoolean() { boolean ret = !value.toBoolean(); @@ -42,7 +34,12 @@ public class NotTreeItem extends UnaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { + public GraphTargetItem invert() { + return value; + } + + @Override + public GraphTargetItem getOriginal() { return value; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/OrTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/OrTreeItem.java index 2e5fe28b4..912b0e676 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/OrTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/OrTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class OrTreeItem extends BinaryOpTreeItem { +public class OrTreeItem extends BinaryOpItem { - public OrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public OrTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreDecrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreDecrementTreeItem.java index 15f657a6c..af39ac156 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreDecrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreDecrementTreeItem.java @@ -16,12 +16,12 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class PreDecrementTreeItem extends UnaryOpTreeItem { - public PreDecrementTreeItem(Action instruction, TreeItem object) { + public PreDecrementTreeItem(GraphSourceItem instruction, TreeItem object) { super(instruction, PRECEDENCE_UNARY, object, "--"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreIncrementTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreIncrementTreeItem.java index d1274391d..047d42312 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreIncrementTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/PreIncrementTreeItem.java @@ -16,12 +16,12 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; public class PreIncrementTreeItem extends UnaryOpTreeItem { - public PreIncrementTreeItem(Action instruction, TreeItem object) { + public PreIncrementTreeItem(GraphSourceItem instruction, TreeItem object) { super(instruction, PRECEDENCE_UNARY, object, "++"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/RShiftTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/RShiftTreeItem.java index 68918b13d..6177431f2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/RShiftTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/RShiftTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class RShiftTreeItem extends BinaryOpTreeItem { +public class RShiftTreeItem extends BinaryOpItem { - public RShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public RShiftTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictEqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictEqTreeItem.java index 210ed0ee7..2195207af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictEqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictEqTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class StrictEqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class StrictEqTreeItem extends BinaryOpItem implements LogicalOpItem { - public StrictEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public StrictEqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); } @@ -31,7 +33,7 @@ public class StrictEqTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new StrictNeqTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new StrictNeqTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictNeqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictNeqTreeItem.java index 965cd2403..3d45c9359 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictNeqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StrictNeqTreeItem.java @@ -16,12 +16,14 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.LogicalOpItem; -public class StrictNeqTreeItem extends BinaryOpTreeItem implements LogicalOp { +public class StrictNeqTreeItem extends BinaryOpItem implements LogicalOpItem { - public StrictNeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public StrictNeqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); } @@ -31,7 +33,7 @@ public class StrictNeqTreeItem extends BinaryOpTreeItem implements LogicalOp { } @Override - public TreeItem invert() { - return new StrictEqTreeItem(instruction, leftSide, rightSide); + public GraphTargetItem invert() { + return new StrictEqTreeItem(src, leftSide, rightSide); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringAddTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringAddTreeItem.java index fc9481500..decf25074 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringAddTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringAddTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class StringAddTreeItem extends BinaryOpTreeItem { +public class StringAddTreeItem extends BinaryOpItem { - public StringAddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public StringAddTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringEqTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringEqTreeItem.java index ea474bc12..088722409 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringEqTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringEqTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class StringEqTreeItem extends BinaryOpTreeItem { +public class StringEqTreeItem extends BinaryOpItem { - public StringEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public StringEqTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLengthTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLengthTreeItem.java index 2beecbb39..6f56c60d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLengthTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLengthTreeItem.java @@ -16,15 +16,16 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; public class StringLengthTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; - public StringLengthTreeItem(Action instruction, TreeItem value) { + public StringLengthTreeItem(GraphSourceItem instruction, GraphTargetItem value) { super(instruction, PRECEDENCE_PRIMARY); this.value = value; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLtTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLtTreeItem.java index 33383f9c8..d18d49d21 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLtTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/StringLtTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class StringLtTreeItem extends BinaryOpTreeItem { +public class StringLtTreeItem extends BinaryOpItem { - public StringLtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public StringLtTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java index cff78065e..e6b4991b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class SubtractTreeItem extends BinaryOpTreeItem { +public class SubtractTreeItem extends BinaryOpItem { - public SubtractTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public SubtractTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/URShiftTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/URShiftTreeItem.java index af632d5f8..58d18ae31 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/URShiftTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/URShiftTreeItem.java @@ -16,12 +16,13 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.BinaryOpItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; -public class URShiftTreeItem extends BinaryOpTreeItem { +public class URShiftTreeItem extends BinaryOpItem { - public URShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + public URShiftTreeItem(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/UnaryOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/UnaryOpTreeItem.java index 271190c10..a255f6dbf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/UnaryOpTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/UnaryOpTreeItem.java @@ -16,17 +16,19 @@ */ package com.jpexs.decompiler.flash.action.treemodel.operations; -import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItem; +import com.jpexs.decompiler.flash.graph.GraphSourceItemPos; +import com.jpexs.decompiler.flash.graph.GraphTargetItem; import java.util.List; public abstract class UnaryOpTreeItem extends TreeItem { - public TreeItem value; + public GraphTargetItem value; public String operator; - public UnaryOpTreeItem(Action instruction, int precedence, TreeItem value, String operator) { + public UnaryOpTreeItem(GraphSourceItem instruction, int precedence, GraphTargetItem value, String operator) { super(instruction, precedence); this.value = value; this.operator = operator; @@ -47,9 +49,9 @@ public abstract class UnaryOpTreeItem extends TreeItem { } @Override - public List getNeededActions() { - List ret = super.getNeededActions(); - ret.addAll(value.getNeededActions()); + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(value.getNeededSources()); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/AndItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/AndItem.java new file mode 100644 index 000000000..0b5ed3d2e --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/AndItem.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; + +public class AndItem extends BinaryOpItem { + + public GraphPart firstPart; + + @Override + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(leftSide.getNeededSources()); + ret.addAll(rightSide.getNeededSources()); + return ret; + } + + public AndItem(GraphSourceItem src, GraphTargetItem leftSide, GraphTargetItem rightSide) { + super(src, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); + this.leftSide = leftSide; + this.rightSide = rightSide; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java new file mode 100644 index 000000000..e3f01b8b8 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; + +public abstract class BinaryOpItem extends GraphTargetItem { + + public GraphTargetItem leftSide; + public GraphTargetItem rightSide; + protected String operator = ""; + + public BinaryOpItem(GraphSourceItem instruction, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator) { + super(instruction, precedence); + this.leftSide = leftSide; + this.rightSide = rightSide; + this.operator = operator; + } + + @Override + public String toString(List localData) { + String ret = ""; + if (leftSide.getPrecedence() > precedence) { + ret += "(" + leftSide.toString(localData) + ")"; + } else { + ret += leftSide.toString(localData); + } + ret += hilight(operator); + if (rightSide.getPrecedence() > precedence) { + ret += "(" + rightSide.toString(localData) + ")"; + } else { + ret += rightSide.toString(localData); + } + return ret; + } + + @Override + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(leftSide.getNeededSources()); + ret.addAll(rightSide.getNeededSources()); + return ret; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/Block.java b/trunk/src/com/jpexs/decompiler/flash/graph/Block.java similarity index 78% rename from trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/Block.java rename to trunk/src/com/jpexs/decompiler/flash/graph/Block.java index 6702a8ec6..072300663 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/Block.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Block.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; +package com.jpexs.decompiler.flash.graph; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; import java.util.List; public interface Block { - public List getContinues(); + public List getContinues(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/BreakItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/BreakItem.java new file mode 100644 index 000000000..380e73c15 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/BreakItem.java @@ -0,0 +1,22 @@ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; + +/** + * + * @author JPEXS + */ +public class BreakItem extends GraphTargetItem { + + public long loopId; + + public BreakItem(GraphSourceItem src, long loopId) { + super(src, NOPRECEDENCE); + this.loopId = loopId; + } + + @Override + public String toString(List localData) { + return hilight("break") + " " + "loop" + loopId; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/ContinueItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/ContinueItem.java new file mode 100644 index 000000000..7b311de84 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/ContinueItem.java @@ -0,0 +1,22 @@ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; + +/** + * + * @author JPEXS + */ +public class ContinueItem extends GraphTargetItem { + + public long loopId; + + public ContinueItem(GraphSourceItem src, long loopId) { + super(src, NOPRECEDENCE); + this.loopId = loopId; + } + + @Override + public String toString(List localData) { + return hilight("continue") + " " + "loop" + loopId; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/DoWhileItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/DoWhileItem.java new file mode 100644 index 000000000..64c14d09f --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/DoWhileItem.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.ArrayList; +import java.util.List; + +public class DoWhileItem extends LoopItem implements Block { + + public List commands; + public GraphTargetItem expression; + + @Override + public boolean needsSemicolon() { + return false; + } + + public DoWhileItem(GraphSourceItem src, Loop loop, List commands, GraphTargetItem expression) { + super(src, loop); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(List localData) { + String ret = ""; + ret += "loop" + loop.id + ":\r\n"; + ret += hilight("do\r\n{") + "\r\n"; + for (GraphTargetItem ti : commands) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; + } + ret += hilight("}\r\nwhile(") + expression.toString(localData) + hilight(");") + "\r\n"; + ret += ":loop" + loop.id; + + return ret; + } + + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/ExitItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/ExitItem.java new file mode 100644 index 000000000..1316ce904 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/ExitItem.java @@ -0,0 +1,8 @@ +package com.jpexs.decompiler.flash.graph; + +/** + * + * @author JPEXS + */ +public interface ExitItem { +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/ForTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/ForTreeItem.java new file mode 100644 index 000000000..03a372027 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/ForTreeItem.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.ArrayList; +import java.util.List; + +public class ForTreeItem extends LoopItem implements Block { + + public List firstCommands; + public GraphTargetItem expression; + public List finalCommands; + public List commands; + + public ForTreeItem(GraphSourceItem src, Loop loop, List firstCommands, GraphTargetItem expression, List finalCommands, List commands) { + super(src, loop); + this.firstCommands = firstCommands; + this.expression = expression; + this.finalCommands = finalCommands; + this.commands = commands; + } + + private String stripSemicolon(String s) { + if (s.endsWith(";")) { + s = s.substring(0, s.length() - 1); + } + return s; + } + + @Override + public String toString(List localData) { + String ret = ""; + ret += "loop" + loop.id + ":\r\n"; + ret += hilight("for("); + for (int i = 0; i < firstCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(firstCommands.get(i).toString(localData)); + } + ret += ";"; + ret += expression.toString(localData); + ret += ";"; + for (int i = 0; i < finalCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(finalCommands.get(i).toString(localData)); + } + ret += hilight(")") + "\r\n{\r\n"; + for (GraphTargetItem ti : commands) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; + } + ret += hilight("}") + "\r\n"; + ret += ":loop" + loop.id; + return ret; + } + + @Override + public boolean needsSemicolon() { + return false; + } + + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index dd8d4a0f4..a855326c4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -17,7 +17,9 @@ package com.jpexs.decompiler.flash.graph; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Stack; /** * @@ -26,6 +28,17 @@ import java.util.List; public class Graph { public List heads; + private GraphSource code; + + public Graph(GraphSource code, List alternateEntries) { + heads = makeGraph(code, new ArrayList(), alternateEntries); + this.code = code; + for (GraphPart head : heads) { + fixGraph(head); + makeMulti(head, new ArrayList()); + } + + } protected static void populateParts(GraphPart part, List allParts) { if (allParts.contains(part)) { @@ -37,7 +50,7 @@ public class Graph { } } - protected void fixGraph(GraphPart part) { + private void fixGraph(GraphPart part) { while (fixGraphOnce(part, new ArrayList(), false)) { } } @@ -142,7 +155,7 @@ public class Graph { return fixed; } - protected void makeMulti(GraphPart part, List visited) { + private void makeMulti(GraphPart part, List visited) { if (visited.contains(part)) { return; } @@ -258,4 +271,1028 @@ public class Graph { } return null; } + + public GraphPart getNextNoJump(GraphPart part) { + while (code.get(part.start).isJump()) { + part = part.getSubParts().get(0).nextParts.get(0); + } + return part; + } + + public static List translateViaGraph(List localData, String path, GraphSource code, List alternateEntries) { + Graph g = new Graph(code, alternateEntries); + List allParts = new ArrayList(); + for (GraphPart head : g.heads) { + populateParts(head, allParts); + } + return g.printGraph(localData, new Stack(), allParts, null, g.heads.get(0), null, new ArrayList(), new HashMap>()); + } + + private List getLoopsContinues(List loops) { + List ret = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + ret.add(l.loopContinue); + } + } + return ret; + } + + protected GraphTargetItem checkLoop(GraphPart part, GraphPart stopPart, List loops) { + if (part == stopPart) { + return null; + } + for (Loop l : loops) { + if (l.loopContinue == part) { + return (new ContinueItem(null, l.id)); + } + if (l.loopBreak == part) { + return (new BreakItem(null, l.id)); + } + } + return null; + } + + private void checkContinueAtTheEnd(List commands, Loop loop) { + if (!commands.isEmpty()) { + if (commands.get(commands.size() - 1) instanceof ContinueItem) { + if (((ContinueItem) commands.get(commands.size() - 1)).loopId == loop.id) { + commands.remove(commands.size() - 1); + } + } + } + } + + protected List check(List localData, List allParts, Stack stack, GraphPart part, GraphPart stopPart, List loops, List output, HashMap> forFinalCommands) { + return null; + } + + protected GraphTargetItem translatePartGetStack(List localData, GraphPart part, Stack stack) { + stack = (Stack) stack.clone(); + translatePart(localData, part, stack); + return stack.pop(); + } + + protected List translatePart(List localData, GraphPart part, Stack stack) { + List sub = part.getSubParts(); + List ret = new ArrayList(); + int end = 0; + for (GraphPart p : sub) { + if (p.end == -1) { + p.end = code.size() - 1; + } + if (p.start == code.size()) { + continue; + } else if (p.end == code.size()) { + p.end--; + } + end = p.end; + int start = p.start; + ret.addAll(code.translatePart(localData, stack, start, end)); + } + return ret; + } + + protected List printGraph(List localData, Stack stack, List allParts, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap> forFinalCommands) { + //String methodPath, Stack stack, Stack scopeStack, List allParts, List parsedExceptions, List finallyJumps, int level, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, HashMap localRegs, MethodBody body, List ignoredSwitches + List ret = new ArrayList(); + boolean debugMode = false; + + + if (debugMode) { + System.err.println("PART " + part); + } + + if (part == stopPart) { + return ret; + } + if (part.ignored) { + return ret; + } + List fqn = new ArrayList(); + //HashMap lrn = new HashMap(); + List output = new ArrayList(); + //boolean isSwitch = false; + + // code.initToSource(); + List parts = new ArrayList(); + if (part instanceof GraphPartMulti) { + parts = ((GraphPartMulti) part).parts; + } else { + parts.add(part); + } + boolean isIf = false; + int end = part.end; + for (GraphPart p : parts) { + end = p.end; + int start = p.start; + isIf = false; + /*if (code.get(end).isBranch()) { + end--; + }*/ + + output.addAll(code.translatePart(localData, stack, start, end)); + + } + if (part.nextParts.size() == 2) { + List retChecked = null; + + if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotItem) && (((NotItem) (stack.get(stack.size() - 1))).getOriginal() == stack.get(stack.size() - 2))) { + ret.addAll(output); + GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); + GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); + boolean reversed = false; + List loopContinues = getLoopsContinues(loops); + loopContinues.add(part); + if (sp1.leadsTo(sp0, loopContinues)) { + } else if (sp0.leadsTo(sp1, loopContinues)) { + reversed = true; + } + GraphPart next = reversed ? sp0 : sp1; + GraphTargetItem ti; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + printGraph(localData, stack, allParts, parent, next, reversed ? sp1 : sp0, loops, forFinalCommands); + GraphTargetItem second = stack.pop(); + GraphTargetItem first = stack.pop(); + if (!reversed) { + AndItem a = new AndItem(null, first, second); + stack.push(a); + a.firstPart = part; + if (second instanceof AndItem) { + a.firstPart = ((AndItem) second).firstPart; + } + if (second instanceof OrItem) { + a.firstPart = ((AndItem) second).firstPart; + } + } else { + OrItem o = new OrItem(null, first, second); + stack.push(o); + o.firstPart = part; + if (second instanceof OrItem) { + o.firstPart = ((OrItem) second).firstPart; + } + if (second instanceof OrItem) { + o.firstPart = ((OrItem) second).firstPart; + } + } + next = reversed ? sp1 : sp0; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(localData, stack, allParts, parent, next, stopPart, loops, forFinalCommands)); + } + } + return ret; + } else if ((stack.size() >= 2) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) { + ret.addAll(output); + GraphPart sp0 = getNextNoJump(part.nextParts.get(0)); + GraphPart sp1 = getNextNoJump(part.nextParts.get(1)); + boolean reversed = false; + List loopContinues = getLoopsContinues(loops); + loopContinues.add(part); + if (sp1.leadsTo(sp0, loopContinues)) { + } else if (sp0.leadsTo(sp1, loopContinues)) { + reversed = true; + } + GraphPart next = reversed ? sp0 : sp1; + GraphTargetItem ti; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + printGraph(localData, stack, allParts, parent, next, reversed ? sp1 : sp0, loops, forFinalCommands); + GraphTargetItem second = stack.pop(); + GraphTargetItem first = stack.pop(); + if (reversed) { + AndItem a = new AndItem(null, first, second); + stack.push(a); + a.firstPart = part; + if (second instanceof AndItem) { + a.firstPart = ((AndItem) second).firstPart; + } + if (second instanceof OrItem) { + a.firstPart = ((AndItem) second).firstPart; + } + } else { + OrItem o = new OrItem(null, first, second); + stack.push(o); + o.firstPart = part; + if (second instanceof OrItem) { + o.firstPart = ((OrItem) second).firstPart; + } + if (second instanceof OrItem) { + o.firstPart = ((OrItem) second).firstPart; + } + } + + next = reversed ? sp1 : sp0; + if ((ti = checkLoop(next, stopPart, loops)) != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(localData, stack, allParts, parent, next, stopPart, loops, forFinalCommands)); + } + } + + return ret; + } else if ((retChecked = check(localData, allParts, stack, part, stopPart, loops, output, forFinalCommands)) != null) { + ret.addAll(retChecked); + return ret; + } /*if ((((ins.definition instanceof IfStrictNeIns)) && ((part.nextParts.get(1).getHeight() == 2) && (code.code.get(part.nextParts.get(1).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) + || (((ins.definition instanceof IfStrictEqIns)) && ((part.nextParts.get(0).getHeight() == 2) && (code.code.get(part.nextParts.get(0).start).definition instanceof PushByteIns) && (code.code.get(part.nextParts.get(0).nextParts.get(0).end).definition instanceof LookupSwitchIns)))) { + ret.addAll(output); + boolean reversed = false; + if (ins.definition instanceof IfStrictEqIns) { + reversed = true; + } + TreeItem switchedObject = null; + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { + switchedObject = ((SetLocalTreeItem) output.get(output.size() - 1)).value; + } + } + if (switchedObject == null) { + switchedObject = new NullTreeItem(null); + } + HashMap caseValuesMap = new HashMap(); + + stack.pop(); + caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); + + GraphPart switchLoc = part.nextParts.get(reversed ? 0 : 1).nextParts.get(0); + + + while ((code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictNeIns) + || (code.code.get(part.nextParts.get(reversed ? 1 : 0).end).definition instanceof IfStrictEqIns)) { + part = part.nextParts.get(reversed ? 1 : 0); + List ps = part.getSubParts(); + for (GraphPart p : ps) { + code.toSourceOutput(false, false, 0, localRegs, stack, scopeStack, abc, abc.constants, abc.method_info, body, p.start, p.end - 1, lrn, fqn, new boolean[code.code.size()]); + } + stack.pop(); + if (code.code.get(part.end).definition instanceof IfStrictNeIns) { + reversed = false; + } else { + reversed = true; + } + caseValuesMap.put(code.code.get(part.nextParts.get(reversed ? 0 : 1).start).operands[0], stack.pop()); + + } + boolean hasDefault = false; + GraphPart dp = part.nextParts.get(reversed ? 1 : 0); + while (code.code.get(dp.start).definition instanceof JumpIns) { + if (dp instanceof GraphPartMulti) { + dp = ((GraphPartMulti) dp).parts.get(0); + } + dp = dp.nextParts.get(0); + } + if (code.code.get(dp.start).definition instanceof PushByteIns) { + hasDefault = true; + } + List caseValues = new ArrayList(); + for (int i = 0; i < switchLoc.nextParts.size() - 1; i++) { + if (caseValuesMap.containsKey(i)) { + caseValues.add(caseValuesMap.get(i)); + } else { + continue; + } + } + + List> caseCommands = new ArrayList>(); + GraphPart next = null; + + List loopContinues = getLoopsContinues(loops); + + next = switchLoc.getNextPartPath(loopContinues); + if (next == null) { + next = switchLoc.getNextSuperPartPath(loopContinues); + } + TreeItem ti = checkLoop(next, stopPart, loops); + Loop currentLoop = new Loop(null, next); + loops.add(currentLoop); + //switchLoc.getNextPartPath(new ArrayList()); + List valuesMapping = new ArrayList(); + List caseBodies = new ArrayList(); + for (int i = 0; i < caseValues.size(); i++) { + GraphPart cur = switchLoc.nextParts.get(1 + i); + if (!caseBodies.contains(cur)) { + caseBodies.add(cur); + } + valuesMapping.add(caseBodies.indexOf(cur)); + } + + List defaultCommands = new ArrayList(); + GraphPart defaultPart = null; + if (hasDefault) { + defaultPart = switchLoc.nextParts.get(switchLoc.nextParts.size() - 1); + defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, defaultPart, next, loops, localRegs, body, ignoredSwitches); + } + + List ignored = new ArrayList(); + for (Loop l : loops) { + ignored.add(l.loopContinue); + } + + for (int i = 0; i < caseBodies.size(); i++) { + List cc = new ArrayList(); + GraphPart nextCase = null; + nextCase = next; + if (next != null) { + if (i < caseBodies.size() - 1) { + if (!caseBodies.get(i).leadsTo(caseBodies.get(i + 1), ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = caseBodies.get(i + 1); + } + } else if (hasDefault) { + if (!caseBodies.get(i).leadsTo(defaultPart, ignored)) { + cc.add(new BreakTreeItem(null, next.start)); + } else { + nextCase = defaultPart; + } + } + } + cc.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, switchLoc, caseBodies.get(i), nextCase, loops, localRegs, body, ignoredSwitches)); + caseCommands.add(cc); + } + + SwitchTreeItem sti = new SwitchTreeItem(null, next == null ? -1 : next.start, switchedObject, caseValues, caseCommands, defaultCommands, valuesMapping); + ret.add(sti); + loops.remove(currentLoop); + if (next != null) { + if (ti != null) { + ret.add(ti); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + return ret; + }*/ + //((IfTypeIns)ins.definition).translateInverted(new HashMap(), co.stack, ins); + } + + /*int ip = part.start; + int addr = code.fixAddrAfterDebugLine(code.pos2adr(part.start)); + int maxend = -1; + List catchedExceptions = new ArrayList(); + for (int e = 0; e < body.exceptions.length; e++) { + if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { + if (!body.exceptions[e].isFinally()) { + if (((body.exceptions[e].end) > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) { + catchedExceptions.clear(); + maxend = code.fixAddrAfterDebugLine(body.exceptions[e].end); + catchedExceptions.add(body.exceptions[e]); + } else if (code.fixAddrAfterDebugLine(body.exceptions[e].end) == maxend) { + catchedExceptions.add(body.exceptions[e]); + } + } + } + } + if (catchedExceptions.size() > 0) { + parsedExceptions.addAll(catchedExceptions); + int endpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end)); + int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); + + + List> catchedCommands = new ArrayList>(); + if (code.code.get(endpos).definition instanceof JumpIns) { + int afterCatchAddr = code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0]; + int afterCatchPos = code.adr2pos(afterCatchAddr); + Collections.sort(catchedExceptions, new Comparator() { + public int compare(ABCException o1, ABCException o2) { + try { + return code.fixAddrAfterDebugLine(o1.target) - code.fixAddrAfterDebugLine(o2.target); + } catch (ConvertException ex) { + return 0; + } + } + }); + + + List finallyCommands = new ArrayList(); + int returnPos = afterCatchPos; + for (int e = 0; e < body.exceptions.length; e++) { + if (body.exceptions[e].isFinally()) { + if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { + if (afterCatchPos + 1 == code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))) { + AVM2Instruction jmpIns = code.code.get(code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end))); + if (jmpIns.definition instanceof JumpIns) { + int finStart = code.adr2pos(code.fixAddrAfterDebugLine(body.exceptions[e].end) + jmpIns.getBytes().length + jmpIns.operands[0]); + finallyJumps.add(finStart); + for (int f = finStart; f < code.code.size(); f++) { + if (code.code.get(f).definition instanceof LookupSwitchIns) { + AVM2Instruction swins = code.code.get(f); + if (swins.operands.length >= 3) { + if (swins.operands[0] == swins.getBytes().length) { + if (code.adr2pos(code.pos2adr(f) + swins.operands[2]) < finStart) { + GraphPart fpart = null; + for (GraphPart p : allParts) { + if (p.start == finStart) { + fpart = p; + break; + } + } + stack.push(new ExceptionTreeItem(body.exceptions[e])); + GraphPart fepart = null; + for (GraphPart p : allParts) { + if (p.start == f + 1) { + fepart = p; + break; + } + } + //code.code.get(f).ignored = true; + ignoredSwitches.add(f); + finallyCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, fpart, fepart, loops, localRegs, body, ignoredSwitches); + returnPos = f + 1; + break; + } + } + } + } + } + + break; + } + } + } + } + } + + for (int e = 0; e < catchedExceptions.size(); e++) { + int eendpos; + if (e < catchedExceptions.size() - 1) { + eendpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2; + } else { + eendpos = afterCatchPos - 1; + } + Stack substack = new Stack(); + substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); + + GraphPart npart = null; + int findpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(e).target)); + for (GraphPart p : allParts) { + if (p.start == findpos) { + npart = p; + break; + } + } + + GraphPart nepart = null; + for (GraphPart p : allParts) { + if (p.start == eendpos + 1) { + nepart = p; + break; + } + } + stack.add(new ExceptionTreeItem(catchedExceptions.get(e))); + catchedCommands.add(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, npart, nepart, loops, localRegs, body, ignoredSwitches)); + } + + GraphPart nepart = null; + + for (GraphPart p : allParts) { + if (p.start == endposStartBlock) { + nepart = p; + break; + } + } + List tryCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, parent, part, nepart, loops, localRegs, body, ignoredSwitches); + + output.clear(); + output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); + ip = returnPos; + addr = code.pos2adr(ip); + } + + } + + if (ip != part.start) { + part = null; + for (GraphPart p : allParts) { + List ps = p.getSubParts(); + for (GraphPart p2 : ps) { + if (p2.start == ip) { + part = p2; + break; + } + } + } + ret.addAll(output); + TreeItem lop = checkLoop(part, stopPart, loops); + if (lop == null) { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, null, part, stopPart, loops, localRegs, body, ignoredSwitches)); + } else { + ret.add(lop); + } + return ret; + }*/ + + List loopContinues = getLoopsContinues(loops); + boolean loop = false; + boolean reversed = false; + boolean whileTrue = false; + Loop whileTrueLoop = null; + if ((!part.nextParts.isEmpty()) && part.nextParts.get(0).leadsTo(part, loopContinues)) { + if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { + if (output.isEmpty()) { + whileTrueLoop = new Loop(part, null); + loops.add(whileTrueLoop); + whileTrue = true; + } else { + loop = true;//doWhile + } + + } else { + loop = true; + } + } else if ((part.nextParts.size() > 1) && part.nextParts.get(1).leadsTo(part, loopContinues)) { + loop = true; + reversed = true; + } + if (((part.nextParts.size() == 2) || ((part.nextParts.size() == 1) && loop)) /*&& (!isSwitch)*/) { + + boolean doWhile = loop; + if (loop && output.isEmpty()) { + doWhile = false; + } + Loop currentLoop = new Loop(part, null); + if (loop) { + loops.add(currentLoop); + } + + loopContinues = new ArrayList(); + for (Loop l : loops) { + if (l.loopContinue != null) { + loopContinues.add(l.loopContinue); + } + } + + if ((part.nextParts.size() > 1) && (!doWhile)) { + currentLoop.loopBreak = part.nextParts.get(reversed ? 0 : 1); + } + + forFinalCommands.put(currentLoop, new ArrayList()); + + GraphTargetItem expr = null; + if (part.nextParts.size() == 1) { + expr = new TrueItem(null); + } else { + if (!stack.isEmpty()) { + expr = stack.pop(); + } + } + if (loop) { + if (expr instanceof AndItem) { + currentLoop.loopContinue = ((AndItem) expr).firstPart; + } + if (expr instanceof OrItem) { + currentLoop.loopContinue = ((OrItem) expr).firstPart; + } + } + + if (doWhile) { + //ret.add(new DoWhileTreeItem(null, currentLoop.id, part.start, output, expr)); + } else { + ret.addAll(output); + } + GraphPart loopBodyStart = null; + GraphPart next = part.getNextPartPath(loopContinues); + if (((!reversed) || loop) && (expr instanceof LogicalOpItem)) { + expr = ((LogicalOpItem) expr).invert(); + } + List retx = ret; + if ((!loop) || (doWhile && (part.nextParts.size() > 1))) { + if (doWhile) { + retx = output; + + } + int stackSizeBefore = stack.size(); + Stack trueStack = (Stack) stack.clone(); + Stack falseStack = (Stack) stack.clone(); + GraphTargetItem lopTrue = checkLoop(part.nextParts.get(1), stopPart, loops); + GraphTargetItem lopFalse = null; + if (next != part.nextParts.get(0)) { + lopFalse = checkLoop(part.nextParts.get(0), stopPart, loops); + } + List onTrue = new ArrayList(); + if (lopTrue != null) { + onTrue.add(lopTrue); + } else { + if (debugMode) { + System.err.println("ONTRUE: (inside " + part + ")"); + } + onTrue = printGraph(localData, trueStack, allParts, part, part.nextParts.get(1), next == null ? stopPart : next, loops, forFinalCommands); + if (debugMode) { + System.err.println("/ONTRUE (inside " + part + ")"); + } + } + List onFalse = new ArrayList(); + if (lopFalse != null) { + onFalse.add(lopFalse); + } else { + if (debugMode) { + System.err.println("ONFALSE: (inside " + part + ")"); + } + onFalse = (((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) ? new ArrayList() : printGraph(localData, falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands)); + if (debugMode) { + System.err.println("/ONFALSE (inside " + part + ")"); + } + } + + if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { + stack.push(new TernarOpItem(null, expr, trueStack.pop(), falseStack.pop())); + } else { + List retw = retx; + if (whileTrue) { + retw = new ArrayList(); + retw.add(new IfItem(null, expr, onTrue, onFalse)); + retx.add(new WhileItem(null, whileTrueLoop, new TrueItem(null), retw)); + } else { + retx.add(new IfItem(null, expr, onTrue, onFalse)); + } + + //Same continues in onTrue and onFalse gets continue on parent level + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onTrue.get(onTrue.size() - 1) instanceof ContinueItem) { + if (onFalse.get(onFalse.size() - 1) instanceof ContinueItem) { + if (((ContinueItem) onTrue.get(onTrue.size() - 1)).loopId == ((ContinueItem) onFalse.get(onFalse.size() - 1)).loopId) { + onTrue.remove(onTrue.size() - 1); + retw.add(onFalse.remove(onFalse.size() - 1)); + } + } + } + } + + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onTrue.get(onTrue.size() - 1) instanceof ExitItem) { + if (onFalse.get(onFalse.size() - 1) instanceof ContinueItem) { + retw.add(onFalse.remove(onFalse.size() - 1)); + } + } + } + + if ((!onTrue.isEmpty()) && (!onFalse.isEmpty())) { + if (onFalse.get(onFalse.size() - 1) instanceof ExitItem) { + if (onTrue.get(onTrue.size() - 1) instanceof ContinueItem) { + retw.add(onTrue.remove(onTrue.size() - 1)); + } + } + } + if (whileTrue) { + checkContinueAtTheEnd(retw, whileTrueLoop); + } + } + if (doWhile) { + loopBodyStart = next; + } + } + if (loop) { // && (!doWhile)) { + List loopBody = new ArrayList(); + List finalCommands = null; + GraphPart finalPart = null; + GraphTargetItem ti; + if (loopBodyStart != null) { + System.err.println("ji"); //TODO: + } + if ((loopBodyStart != null) && ((ti = checkLoop(loopBodyStart, stopPart, loops)) != null)) { + loopBody.add(ti); + } else { + if (!(doWhile && (loopBodyStart == null))) { + loopBody = printGraph(localData, stack, allParts, part, loopBodyStart != null ? loopBodyStart : part.nextParts.get(reversed ? 1 : 0), stopPart, loops, forFinalCommands); + + } + } + checkContinueAtTheEnd(loopBody, currentLoop); + finalCommands = forFinalCommands.get(currentLoop); + if (!finalCommands.isEmpty()) { + ret.add(new ForTreeItem(null, currentLoop, new ArrayList(), expr, finalCommands, loopBody)); + } /*else if ((expr instanceof HasNextTreeItem) && ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister() instanceof FilteredCheckTreeItem) { + TreeItem gti = ((HasNextTreeItem) expr).collection.getNotCoerced().getThroughRegister(); + boolean found = false; + if ((loopBody.size() == 3) || (loopBody.size() == 4)) { + TreeItem ft = loopBody.get(0); + if (ft instanceof WithTreeItem) { + ft = loopBody.get(1); + if (ft instanceof IfItem) { + IfItem ift = (IfItem) ft; + if (ift.onTrue.size() > 0) { + ft = ift.onTrue.get(0); + if (ft instanceof SetPropertyTreeItem) { + SetPropertyTreeItem spt = (SetPropertyTreeItem) ft; + if (spt.object instanceof LocalRegTreeItem) { + int regIndex = ((LocalRegTreeItem) spt.object).regIndex; + HasNextTreeItem iti = (HasNextTreeItem) expr; + localRegs.put(regIndex, new FilterTreeItem(null, iti.collection.getThroughRegister(), ift.expression)); + } + } + } + } + } + } + } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextValueTreeItem)) { + TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); + loopBody.remove(0); + ret.add(new ForEachInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); + } else if ((expr instanceof HasNextTreeItem) && (!loopBody.isEmpty()) && (loopBody.get(0) instanceof SetTypeTreeItem) && (((SetTypeTreeItem) loopBody.get(0)).getValue().getNotCoerced() instanceof NextNameTreeItem)) { + TreeItem obj = ((SetTypeTreeItem) loopBody.get(0)).getObject(); + loopBody.remove(0); + ret.add(new ForInTreeItem(null, currentLoop.id, part.start, new InTreeItem(expr.instruction, obj, ((HasNextTreeItem) expr).collection), loopBody)); + }*/ else { + if (doWhile) { + if (stack.isEmpty()) { + expr = new TrueItem(null); + } else { + expr = stack.pop(); + } + loopBody.addAll(0, output); + checkContinueAtTheEnd(loopBody, currentLoop); + + List addIf = new ArrayList(); + if ((!loopBody.isEmpty()) && (loopBody.get(loopBody.size() - 1) instanceof IfItem)) { + IfItem ift = (IfItem) loopBody.get(loopBody.size() - 1); + if (ift.onFalse.isEmpty() || ((ift.onFalse.size() == 1) && (ift.onFalse.get(0) instanceof ContinueItem) && (((ContinueItem) ift.onFalse.get(0)).loopId == currentLoop.id))) { + expr = ift.expression; + addIf = ift.onTrue; + loopBody.remove(loopBody.size() - 1); + } + } + ret.add(new DoWhileItem(null, currentLoop, loopBody, expr)); + ret.addAll(addIf); + + } else { + ret.add(new WhileItem(null, currentLoop, expr, loopBody)); + } + } + } + if ((!doWhile) && (!whileTrue) && loop && (part.nextParts.size() > 1)) { + loops.remove(currentLoop); //remove loop so no break shows up + //ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level, part, part.nextParts.get(reversed ? 0 : 1), stopPart, loops, localRegs, body, ignoredSwitches)); + next = part.nextParts.get(reversed ? 0 : 1); + } + if (doWhile) { + next = null; + } + if (next != null) { + boolean finallyJump = false; + /*for (int f : finallyJumps) { + if (next.start == f) { + finallyJump = true; + break; + } + }*/ + if (!finallyJump) { + GraphTargetItem ti = checkLoop(next, stopPart, loops); + if (ti != null) { + ret.add(ti); + } else { + if (debugMode) { + System.err.println("NEXT: (inside " + part + ")"); + } + ret.addAll(printGraph(localData, stack, allParts, part, next, stopPart, loops, forFinalCommands)); + if (debugMode) { + System.err.println("/NEXT: (inside " + part + ")"); + } + } + } + } + } else { + ret.addAll(output); + } + onepart: + if (part.nextParts.size() == 1 && (!loop)) { + /*if (part.end - part.start > 4) { + if (code.code.get(part.end).definition instanceof PopIns) { + if (code.code.get(part.end - 1).definition instanceof LabelIns) { + if (code.code.get(part.end - 2).definition instanceof PushByteIns) { + + //if (code.code.get(part.end - 3).definition instanceof SetLocalTypeIns) { + if (part.nextParts.size() == 1) { + GraphPart sec = part.nextParts.get(0); + + if (code.code.get(sec.end).definition instanceof ReturnValueIns) { + if (sec.end - sec.start >= 3) { + if (code.code.get(sec.end - 1).definition instanceof KillIns) { + if (code.code.get(sec.end - 2).definition instanceof GetLocalTypeIns) { + if (!output.isEmpty()) { + if (output.get(output.size() - 1) instanceof SetLocalTreeItem) { + sec.ignored = true; + ret.add(new ReturnValueTreeItem(code.code.get(sec.end), ((SetLocalTreeItem) output.get(output.size() - 1)).value)); + break onepart; + } + } + } + } + } + + } else if (code.code.get(sec.end).definition instanceof ReturnVoidIns) { + ret.add(new ReturnVoidTreeItem(code.code.get(sec.end))); + break onepart; + } + //} + } + } + } + } + } + + for (int f : finallyJumps) { + if (part.nextParts.get(0).start == f) { + if ((!output.isEmpty()) && (output.get(output.size() - 1) instanceof SetLocalTreeItem)) { + ret.add(new ReturnValueTreeItem(null, ((SetLocalTreeItem) output.get(output.size() - 1)).value)); + } else { + ret.add(new ReturnVoidTreeItem(null)); + } + + break onepart; + } + } + */ + GraphPart p = part.nextParts.get(0); + GraphTargetItem lop = checkLoop(p, stopPart, loops); + if (lop == null) { + if (p.path.length() == part.path.length()) { + ret.addAll(printGraph(localData, stack, allParts, part, p, stopPart, loops, forFinalCommands)); + } else { + if ((p != stopPart) && (p.refs.size() > 1)) { + List nextList = new ArrayList(); + populateParts(p, nextList); + Loop nearestLoop = null; + loopn: + for (GraphPart n : nextList) { + for (Loop l : loops) { + if (l.loopContinue == n) { + nearestLoop = l; + break loopn; + } + } + } + if ((nearestLoop != null) && (nearestLoop.loopBreak != null)) { + List finalCommands = printGraph(localData, stack, allParts, part, p, nearestLoop.loopContinue, loops, forFinalCommands); + nearestLoop.loopContinue = p; + forFinalCommands.put(nearestLoop, finalCommands); + ContinueItem cti = new ContinueItem(null, nearestLoop.id); + ret.add(cti); + } + } + } + } else { + ret.add(lop); + } + //} + //ret += (strOfChars(level, TAB) + "continue;\r\n"); + //} + } + /*if (isSwitch && (!ignoredSwitches.contains(part.end))) { + //ret.add(new CommentTreeItem(code.code.get(part.end), "Switch not supported")); + TreeItem switchedObject = stack.pop(); + List caseValues = new ArrayList(); + List valueMappings = new ArrayList(); + List> caseCommands = new ArrayList>(); + + GraphPart next = part.getNextPartPath(loopContinues); + int breakPos = -1; + if (next != null) { + breakPos = next.start; + } + List defaultCommands = printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(0), stopPart, loops, localRegs, body, ignoredSwitches); + + for (int i = 0; i < part.nextParts.size() - 1; i++) { + caseValues.add(new IntegerValueTreeItem(null, (Long) (long) i)); + valueMappings.add(i); + GraphPart nextCase = next; + List caseBody = new ArrayList(); + if (i < part.nextParts.size() - 1 - 1) { + if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(1 + i + 1), new ArrayList())) { + caseBody.add(new BreakTreeItem(null, breakPos)); + } else { + nextCase = part.nextParts.get(1 + i + 1); + } + } else if (!part.nextParts.get(1 + i).leadsTo(part.nextParts.get(0), new ArrayList())) { + caseBody.add(new BreakTreeItem(null, breakPos)); + } else { + nextCase = part.nextParts.get(0); + } + caseBody.addAll(0, printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, part.nextParts.get(1 + i), nextCase, loops, localRegs, body, ignoredSwitches)); + caseCommands.add(caseBody); + } + + SwitchTreeItem swt = new SwitchTreeItem(null, breakPos, switchedObject, caseValues, caseCommands, defaultCommands, valueMappings); + ret.add(swt); + + if (next != null) { + TreeItem lopNext = checkLoop(next, stopPart, loops); + if (lopNext != null) { + ret.add(lopNext); + } else { + ret.addAll(printGraph(methodPath, stack, scopeStack, allParts, parsedExceptions, finallyJumps, level + 1, part, next, stopPart, loops, localRegs, body, ignoredSwitches)); + } + } + + }*/ + + /*code.clearTemporaryRegisters(ret); + if (!part.forContinues.isEmpty()) { + throw new ForException(new ArrayList(), ret, part); + }*/ + return ret; + } + + private List makeGraph(GraphSource code, List allBlocks, List alternateEntries) { + HashMap> refs = code.visitCode(alternateEntries); + List ret = new ArrayList(); + boolean visited[] = new boolean[code.size()]; + ret.add(makeGraph(null, "0", code, 0, 0, allBlocks, refs, visited)); + for (int pos : alternateEntries) { + GraphPart e1 = new GraphPart(-1, -1); + e1.path = "e"; + makeGraph(e1, "e", code, pos, pos, allBlocks, refs, visited); + } + return ret; + } + + private GraphPart makeGraph(GraphPart parent, String path, GraphSource code, int startip, int lastIp, List allBlocks, HashMap> refs, boolean visited2[]) { + + int ip = startip; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + p.refs.add(parent); + return p; + } + } + GraphPart g; + GraphPart ret = new GraphPart(ip, -1); + ret.path = path; + GraphPart part = ret; + while (ip < code.size()) { + if (visited2[ip] || ((ip != startip) && (refs.get(ip).size() > 1))) { + part.end = lastIp; + GraphPart found = null; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + found = p; + break; + } + } + + allBlocks.add(part); + + if (found != null) { + part.nextParts.add(found); + found.refs.add(part); + break; + } else { + GraphPart gp = new GraphPart(ip, -1); + gp.path = path; + part.nextParts.add(gp); + gp.refs.add(part); + part = gp; + } + } + lastIp = ip; + GraphSourceItem ins = code.get(ip); + if (ins.isExit()) { + part.end = ip; + allBlocks.add(part); + break; + } else if (ins.isJump()) { + part.end = ip; + allBlocks.add(part); + ip = ins.getBranches(code).get(0); + part.nextParts.add(g = makeGraph(part, path, code, ip, lastIp, allBlocks, refs, visited2)); + g.refs.add(part); + break; + } else if (ins.isBranch()) { + part.end = ip; + allBlocks.add(part); + List branches = ins.getBranches(code); + for (int i = 0; i < branches.size(); i++) { + part.nextParts.add(g = makeGraph(part, path + i, code, branches.get(i), ip, allBlocks, refs, visited2)); + g.refs.add(part); + } + break; + } + ip++; + } + if ((part.end == -1) && (ip >= code.size())) { + if (part.start == code.size()) { + part.end = code.size(); + allBlocks.add(part); + } else { + part.end = ip - 1; + for (GraphPart p : allBlocks) { + if (p.start == ip) { + p.refs.add(part); + part.nextParts.add(p); + return ret; + } + } + GraphPart gp = new GraphPart(ip, ip); + allBlocks.add(gp); + gp.refs.add(part); + part.nextParts.add(gp); + allBlocks.add(part); + } + } + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/GraphSource.java b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSource.java new file mode 100644 index 000000000..62f6c89d3 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSource.java @@ -0,0 +1,64 @@ +package com.jpexs.decompiler.flash.graph; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Stack; + +/** + * + * @author JPEXS + */ +public abstract class GraphSource { + + public abstract int size(); + + public abstract GraphSourceItem get(int pos); + + public abstract boolean isEmpty(); + + public abstract List translatePart(List localData, Stack stack, int start, int end); + + private void visitCode(int ip, int lastIp, HashMap> refs) { + while (ip < size()) { + refs.get(ip).add(lastIp); + lastIp = ip; + if (refs.get(ip).size() > 1) { + break; + } + GraphSourceItem ins = get(ip); + + + if (ins.isExit()) { + break; + } + + if (ins.isBranch() || ins.isJump()) { + List branches = ins.getBranches(this); + for (int b : branches) { + visitCode(b, ip, refs); + } + break; + } + ip++; + }; + } + + public HashMap> visitCode(List alternateEntries) { + HashMap> refs = new HashMap>(); + for (int i = 0; i < size(); i++) { + refs.put(i, new ArrayList()); + } + visitCode(0, 0, refs); + int pos = 0; + for (int e : alternateEntries) { + pos++; + visitCode(e, -pos, refs); + } + return refs; + } + + public abstract int adr2pos(long adr); + + public abstract long pos2adr(int pos); +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItem.java new file mode 100644 index 000000000..fbbd1fb7e --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItem.java @@ -0,0 +1,23 @@ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; +import java.util.Stack; + +/** + * + * @author JPEXS + */ +public interface GraphSourceItem { + + public void translate(List localData, Stack stack, List output); + + public boolean isJump(); + + public boolean isBranch(); + + public boolean isExit(); + + public long getOffset(); + + public List getBranches(GraphSource code); +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/IgnoredPair.java b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItemPos.java similarity index 77% rename from trunk/src/com/jpexs/decompiler/flash/action/IgnoredPair.java rename to trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItemPos.java index 31c8970e3..d8da3ecf9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/IgnoredPair.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/GraphSourceItemPos.java @@ -14,19 +14,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.action; +package com.jpexs.decompiler.flash.graph; /** * * @author JPEXS */ -public class IgnoredPair { +public class GraphSourceItemPos { - public Action action; + public GraphSourceItem item; public int pos; - public IgnoredPair(Action action, int pos) { - this.action = action; + public GraphSourceItemPos(GraphSourceItem item, int pos) { + this.item = item; this.pos = pos; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/GraphTargetItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/GraphTargetItem.java new file mode 100644 index 000000000..096da49a6 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/GraphTargetItem.java @@ -0,0 +1,105 @@ +package com.jpexs.decompiler.flash.graph; + +import com.jpexs.decompiler.flash.helpers.Helper; +import com.jpexs.decompiler.flash.helpers.Highlighting; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author JPEXS + */ +public abstract class GraphTargetItem { + + public static final int PRECEDENCE_PRIMARY = 0; + public static final int PRECEDENCE_POSTFIX = 1; + public static final int PRECEDENCE_UNARY = 2; + public static final int PRECEDENCE_MULTIPLICATIVE = 3; + public static final int PRECEDENCE_ADDITIVE = 4; + public static final int PRECEDENCE_BITWISESHIFT = 5; + public static final int PRECEDENCE_RELATIONAL = 6; + public static final int PRECEDENCE_EQUALITY = 7; + public static final int PRECEDENCE_BITWISEAND = 8; + public static final int PRECEDENCE_BITWISEXOR = 9; + public static final int PRECEDENCE_BITWISEOR = 10; + public static final int PRECEDENCE_LOGICALAND = 11; + public static final int PRECEDENCE_LOGICALOR = 12; + public static final int PRECEDENCE_CONDITIONAL = 13; + public static final int PRECEDENCE_ASSIGMENT = 14; + public static final int PRECEDENCE_COMMA = 15; + public static final int NOPRECEDENCE = 16; + public GraphSourceItem src; + public int pos = 0; + public int precedence; + public List moreSrc = new ArrayList(); + + public GraphTargetItem(GraphSourceItem src, int precedence) { + this.src = src; + this.precedence = precedence; + } + + public List getNeededSources() { + List ret = new ArrayList(); + ret.add(new GraphSourceItemPos(src, pos)); + ret.addAll(moreSrc); + return ret; + } + + public String hilight(String str) { + if (src == null) { + return str; + } + return Highlighting.hilighOffset(str, src.getOffset()); + } + + public String toStringSemicoloned(List localData) { + return toString(localData) + (needsSemicolon() ? ";" : ""); + } + + public boolean needsSemicolon() { + return true; + } + + @Override + public String toString() { + return toString(new ArrayList()); + } + + public abstract String toString(List localData); + + public String toString(Object o) { + return toString(Helper.toList(o)); + } + + public int getPrecedence() { + return precedence; + } + + public boolean isCompileTime() { + return false; + } + + public double toNumber() { + return 0; + } + + public boolean toBoolean() { + return Double.compare(toNumber(), 0.0) != 0; + } + + public String toStringNoQuotes(List localData) { + return toString(localData); + } + + public String toStringNoQuotes(Object o) { + return toString(Helper.toList(o)); + } + + public GraphTargetItem getNotCoerced() { + return this; + } + + public GraphTargetItem getThroughRegister() { + return this; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java new file mode 100644 index 000000000..a527d9b28 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.ArrayList; +import java.util.List; + +public class IfItem extends GraphTargetItem implements Block { + + public GraphTargetItem expression; + public List onTrue; + public List onFalse; + + public IfItem(GraphSourceItem src, GraphTargetItem expression, List onTrue, List onFalse) { + super(src, NOPRECEDENCE); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; + } + + @Override + public String toString(List localData) { + String ret; + ret = hilight("if(") + expression.toString(localData) + hilight(")") + "\r\n{\r\n"; + for (GraphTargetItem ti : onTrue) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; + } + ret += hilight("}"); + if (onFalse.size() > 0) { + ret += "\r\n" + hilight("else") + "\r\n" + hilight("{") + "\r\n"; + for (GraphTargetItem ti : onFalse) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; + } + ret += hilight("}"); + } + return ret; + } + + @Override + public boolean needsSemicolon() { + return false; + } + + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : onTrue) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + for (GraphTargetItem ti : onFalse) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/LogicalOpItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/LogicalOpItem.java new file mode 100644 index 000000000..bcfb7ae1d --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/LogicalOpItem.java @@ -0,0 +1,10 @@ +package com.jpexs.decompiler.flash.graph; + +/** + * + * @author JPEXS + */ +public interface LogicalOpItem { + + public GraphTargetItem invert(); +} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LogicalOp.java b/trunk/src/com/jpexs/decompiler/flash/graph/LoopItem.java similarity index 73% rename from trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LogicalOp.java rename to trunk/src/com/jpexs/decompiler/flash/graph/LoopItem.java index 7738c69af..94da7df51 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/LogicalOp.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/LoopItem.java @@ -14,15 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.action.treemodel.operations; +package com.jpexs.decompiler.flash.graph; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; +public abstract class LoopItem extends GraphTargetItem { -/** - * - * @author JPEXS - */ -public interface LogicalOp { + public Loop loop; - public TreeItem invert(); + public LoopItem(GraphSourceItem src, Loop loop) { + super(src, NOPRECEDENCE); + this.loop = loop; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/NotItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/NotItem.java new file mode 100644 index 000000000..7c0117d67 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/NotItem.java @@ -0,0 +1,10 @@ +package com.jpexs.decompiler.flash.graph; + +/** + * + * @author Jindra + */ +public interface NotItem { + + public GraphTargetItem getOriginal(); +} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/Block.java b/trunk/src/com/jpexs/decompiler/flash/graph/OrItem.java similarity index 53% rename from trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/Block.java rename to trunk/src/com/jpexs/decompiler/flash/graph/OrItem.java index 16718f5db..b5680f0e1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/Block.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/OrItem.java @@ -14,12 +14,25 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; +package com.jpexs.decompiler.flash.graph; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.ContinueTreeItem; import java.util.List; -public interface Block { +public class OrItem extends BinaryOpItem { - public List getContinues(); + public GraphPart firstPart; + + public OrItem(GraphSourceItem src, GraphTargetItem leftSide, GraphTargetItem rightSide) { + super(src, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); + this.leftSide = leftSide; + this.rightSide = rightSide; + } + + @Override + public List getNeededSources() { + List ret = super.getNeededSources(); + ret.addAll(leftSide.getNeededSources()); + ret.addAll(rightSide.getNeededSources()); + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/SwitchTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/SwitchItem.java similarity index 55% rename from trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/SwitchTreeItem.java rename to trunk/src/com/jpexs/decompiler/flash/graph/SwitchItem.java index f7ccdbf24..01a20bfc9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/SwitchTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/SwitchItem.java @@ -14,25 +14,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; +package com.jpexs.decompiler.flash.graph; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.ContinueTreeItem; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; import java.util.ArrayList; import java.util.List; -public class SwitchTreeItem extends LoopTreeItem implements Block { +public class SwitchItem extends LoopItem implements Block { - public TreeItem switchedObject; - public List caseValues; - public List> caseCommands; - public List defaultCommands; + public GraphTargetItem switchedObject; + public List caseValues; + public List> caseCommands; + public List defaultCommands; public List valuesMapping; - public SwitchTreeItem(Action instruction, long switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands, List valuesMapping) { - super(instruction, switchBreak, -1); + public SwitchItem(Action instruction, Loop loop, GraphTargetItem switchedObject, List caseValues, List> caseCommands, List defaultCommands, List valuesMapping) { + super(instruction, loop); this.switchedObject = switchedObject; this.caseValues = caseValues; this.caseCommands = caseCommands; @@ -41,19 +38,19 @@ public class SwitchTreeItem extends LoopTreeItem implements Block { } @Override - public String toString(ConstantPool constants) { + public String toString(List localData) { String ret = ""; - ret += "loopswitch" + loopBreak + ":\r\n"; - ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n"; + ret += "loopswitch" + loop.id + ":\r\n"; + ret += hilight("switch(") + switchedObject.toString(localData) + hilight(")") + "\r\n{\r\n"; for (int i = 0; i < caseCommands.size(); i++) { for (int k = 0; k < valuesMapping.size(); k++) { if (valuesMapping.get(k) == i) { - ret += "case " + caseValues.get(k).toString(constants) + ":\r\n"; + ret += "case " + caseValues.get(k).toString(localData) + ":\r\n"; } } ret += Action.INDENTOPEN + "\r\n"; for (int j = 0; j < caseCommands.get(i).size(); j++) { - ret += caseCommands.get(i).get(j).toString(constants) + "\r\n"; + ret += caseCommands.get(i).get(j).toStringSemicoloned(localData) + "\r\n"; } ret += Action.INDENTCLOSE + "\r\n"; } @@ -62,23 +59,24 @@ public class SwitchTreeItem extends LoopTreeItem implements Block { ret += hilight("default") + ":\r\n"; ret += Action.INDENTOPEN + "\r\n"; for (int j = 0; j < defaultCommands.size(); j++) { - ret += defaultCommands.get(j).toString(constants) + "\r\n"; + ret += defaultCommands.get(j).toStringSemicoloned(localData) + "\r\n"; } ret += Action.INDENTCLOSE + "\r\n"; } } ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; + ret += ":loop" + loop.id; return ret; } - public List getContinues() { - List ret = new ArrayList(); + @Override + public List getContinues() { + List ret = new ArrayList(); - for (List onecase : caseCommands) { - for (TreeItem ti : onecase) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (List onecase : caseCommands) { + for (GraphTargetItem ti : onecase) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); @@ -86,9 +84,9 @@ public class SwitchTreeItem extends LoopTreeItem implements Block { } } if (defaultCommands != null) { - for (TreeItem ti : defaultCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); + for (GraphTargetItem ti : defaultCommands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); } if (ti instanceof Block) { ret.addAll(((Block) ti).getContinues()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/BreakTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/TernarOpItem.java similarity index 53% rename from trunk/src/com/jpexs/decompiler/flash/action/treemodel/BreakTreeItem.java rename to trunk/src/com/jpexs/decompiler/flash/graph/TernarOpItem.java index 2150f244a..47b7906fd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/BreakTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/TernarOpItem.java @@ -14,27 +14,25 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.action.treemodel; +package com.jpexs.decompiler.flash.graph; -import com.jpexs.decompiler.flash.action.Action; +import java.util.List; -public class BreakTreeItem extends TreeItem { +public class TernarOpItem extends GraphTargetItem { - public long loopPos; - public boolean isKnown; + public GraphTargetItem expression; + public GraphTargetItem onTrue; + public GraphTargetItem onFalse; - public BreakTreeItem(Action instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public BreakTreeItem(Action instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; + public TernarOpItem(GraphSourceItem src, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) { + super(src, PRECEDENCE_CONDITIONAL); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; } @Override - public String toString(ConstantPool constants) { - return hilight("break") + " loop" + loopPos + ";"; + public String toString(List localData) { + return expression.toString(localData) + hilight("?") + onTrue.toString(localData) + hilight(":") + onFalse.toString(localData); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/TrueItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/TrueItem.java new file mode 100644 index 000000000..ebe27a03c --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/TrueItem.java @@ -0,0 +1,19 @@ +package com.jpexs.decompiler.flash.graph; + +import java.util.List; + +/** + * + * @author JPEXS + */ +public class TrueItem extends GraphTargetItem { + + public TrueItem(GraphSourceItem src) { + super(src, PRECEDENCE_PRIMARY); + } + + @Override + public String toString(List localData) { + return "true"; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/WhileItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/WhileItem.java new file mode 100644 index 000000000..2128d43a6 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/graph/WhileItem.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010-2013 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.graph; + +import java.util.ArrayList; +import java.util.List; + +public class WhileItem extends LoopItem implements Block { + + public GraphTargetItem expression; + public List commands; + + public WhileItem(GraphSourceItem src, Loop loop, GraphTargetItem expression, List commands) { + super(src, loop); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(List localData) { + String ret = ""; + ret += "loop" + loop.id + ":\r\n"; + ret += hilight("while(") + expression.toString(localData) + hilight(")") + "\r\n{\r\n"; + for (GraphTargetItem ti : commands) { + ret += ti.toStringSemicoloned(localData) + "\r\n"; + } + ret += hilight("}") + "\r\n"; + ret += ":loop" + loop.id; + return ret; + } + + @Override + public List getContinues() { + List ret = new ArrayList(); + for (GraphTargetItem ti : commands) { + if (ti instanceof ContinueItem) { + ret.add((ContinueItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } + + @Override + public boolean needsSemicolon() { + return false; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinBase.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinBase.java index de7d6f1b0..75055113b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinBase.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinBase.java @@ -13,7 +13,6 @@ package com.jpexs.decompiler.flash.gui.player.jna.platform.win32; import com.jpexs.decompiler.flash.gui.player.jna.platform.win32.WinNT.HANDLE; - import com.sun.jna.Platform; import com.sun.jna.Pointer; import com.sun.jna.Structure; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinDef.java b/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinDef.java index 1467e37ef..8e541ea8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinDef.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/player/jna/platform/win32/WinDef.java @@ -14,7 +14,6 @@ package com.jpexs.decompiler.flash.gui.player.jna.platform.win32; import com.jpexs.decompiler.flash.gui.player.jna.platform.win32.BaseTSD.LONG_PTR; import com.jpexs.decompiler.flash.gui.player.jna.platform.win32.WinNT.HANDLE; - import com.sun.jna.IntegerType; import com.sun.jna.Pointer; import com.sun.jna.Structure; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/Helper.java b/trunk/src/com/jpexs/decompiler/flash/helpers/Helper.java index b9cc97175..97f223296 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/Helper.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/Helper.java @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.util.ArrayList; import java.util.List; /** @@ -264,4 +265,12 @@ public class Helper { return null; } } + + public static List toList(Object... rest) { + List ret = new ArrayList(); + for (Object o : rest) { + ret.add(o); + } + return ret; + } }