diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 52a6861bf..0dc59470c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -931,7 +931,7 @@ public class SWFInputStream extends InputStream { futureResults.add(future); } } - + if (tag.getId() == EndTag.ID) { break; } diff --git a/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java b/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java index f69d0295a..6dcc49d68 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java +++ b/trunk/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java @@ -16,11 +16,9 @@ */ package com.jpexs.decompiler.flash; -import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference; import com.jpexs.decompiler.flash.abc.types.ABCException; -import java.io.IOException; +import com.jpexs.decompiler.flash.abc.types.MethodBody; import java.io.Serializable; -import java.nio.CharBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -36,12 +34,17 @@ public class SourceGeneratorLocalData implements Serializable { public Integer inFunction; public Boolean inMethod; public Integer forInLevel; + + //TODO: handle AVM2 separately public List exceptions = new ArrayList<>(); public List finallyCatches = new ArrayList(); - public Map finallyCounter = new HashMap<>(); + public Map finallyCounter = new HashMap<>(); public int finallyRegister = -1; public String currentClass; public int activationReg = 0; + public List callStack = new ArrayList<>(); + public Map> traitUsages = new HashMap<>(); + public String pkg = ""; public SourceGeneratorLocalData(HashMap registerVars, Integer inFunction, Boolean inMethod, Integer forInLevel) { this.registerVars = registerVars; 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 957300a95..41d20765f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -1851,8 +1851,14 @@ public class AVM2Code implements Serializable { AVM2Instruction ins = code.get(pos); if (stats.instructionStats[pos].seen) { //check stack mismatch here - return true; + return true; } + + if (ins.definition instanceof NewFunctionIns) { + MethodBody innerBody = abc.findBody(ins.operands[0]); + innerBody.autoFillStats(abc, stats.initscope + (stats.has_activation ? 1 : 0)); + } + stats.instructionStats[pos].seen = true; stats.instructionStats[pos].stackpos = stack; stats.instructionStats[pos].scopepos = scope; @@ -1938,12 +1944,13 @@ public class AVM2Code implements Serializable { public CodeStats getStats(ABC abc, MethodBody body, int initScope) { CodeStats stats = new CodeStats(this); + stats.initscope = initScope; if (!walkCode(stats, 0, 0, initScope, abc)) { return null; } int scopePos = -1; int prevStart = 0; - for (int e=0;e toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (!hasReturnValue()) { return toSource(localData, generator); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/BooleanAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/BooleanAVM2Item.java index 77a11923a..2e83d2b70 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/BooleanAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/BooleanAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushFalseIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushTrueIns; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -54,7 +55,7 @@ public class BooleanAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, value ? new PushTrueIns() : new PushFalseIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallPropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallPropertyAVM2Item.java index 7a7b8e6ab..e89600856 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallPropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CallPropertyAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.executing.CallPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -58,7 +59,7 @@ public class CallPropertyAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, receiver, arguments, new AVM2Instruction(0, new CallPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName), arguments.size()}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java index 967e2b2fa..089e898f4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -101,7 +102,7 @@ public class CoerceAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { /*if (value.returnType().toString().equals(type)) { return toSourceMerge(localData, generator, value); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java index 42997bf5a..e6b107308 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructSuperAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.ConstructSuperIns; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -66,7 +67,7 @@ public class ConstructSuperAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, args, new AVM2Instruction(0, new ConstructSuperIns(), new int[]{args.size()}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java index 4a2a76b66..172e492d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushDoubleIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -54,7 +55,7 @@ public class FloatValueAVM2Item extends NumberValueAVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new PushDoubleIns(), new int[]{((AVM2SourceGenerator) generator).abc.constants.getDoubleId(value, true)}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetPropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetPropertyAVM2Item.java index fdc63e6e5..d4fc2db07 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetPropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/GetPropertyAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.GetPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -45,7 +46,7 @@ public class GetPropertyAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, new AVM2Instruction(0, new GetPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java index 77068ab76..f8467e63d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/IntegerValueAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushIntIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushShortIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -56,7 +57,7 @@ public class IntegerValueAVM2Item extends NumberValueAVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2Instruction ins = null; if (value >= 0 && value <= 255) { ins = new AVM2Instruction(0, new PushByteIns(), new int[]{(int) (long) value}, new byte[0]); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java index 29c4b8cce..b5f4c8c87 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/LocalRegAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.GetLocalIns; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.FilterAVM2Item; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -88,7 +89,7 @@ public class LocalRegAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2Instruction ins; switch (regIndex) { case 0: diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java index 97366c180..65d5b23ba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NanAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNanIns; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class NanAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new PushNanIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java index ef895a902..8bb34e500 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewArrayAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewArrayIns; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -59,7 +60,7 @@ public class NewArrayAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, values, new AVM2Instruction(0, new NewArrayIns(), new int[]{values.size()}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java index f955d9218..a55d0cc94 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NewObjectAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewObjectIns; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -77,7 +78,7 @@ public class NewObjectAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List args = new ArrayList<>(); for (NameValuePair p : pairs) { args.add(p.name); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java index a1522b975..8a4a1bae2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/NullAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushNullIns; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -51,7 +52,7 @@ public class NullAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new PushNullIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostDecrementAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostDecrementAVM2Item.java index a3586bde2..bbad80aec 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostDecrementAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostDecrementAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.AssignmentAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -59,7 +60,7 @@ public class PostDecrementAVM2Item extends AVM2Item implements AssignmentAVM2Ite } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (object instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) object).toSourceChange(localData, generator, true, true, true); } @@ -67,7 +68,7 @@ public class PostDecrementAVM2Item extends AVM2Item implements AssignmentAVM2Ite } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (object instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) object).toSourceChange(localData, generator, true, true, false); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostIncrementAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostIncrementAVM2Item.java index 58ac3ed7f..21b483436 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostIncrementAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/PostIncrementAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.AssignmentAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -58,8 +59,8 @@ public class PostIncrementAVM2Item extends AVM2Item implements AssignmentAVM2Ite return true; } - @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + @Override + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (object instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) object).toSourceChange(localData, generator, true, false, true); } @@ -67,7 +68,7 @@ public class PostIncrementAVM2Item extends AVM2Item implements AssignmentAVM2Ite } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (object instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) object).toSourceChange(localData, generator, true, false, false); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnValueAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnValueAVM2Item.java index cc5f4c827..4e77049d6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnValueAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnValueAVM2Item.java @@ -18,16 +18,15 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnValueIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.ExitItem; import com.jpexs.decompiler.graph.model.LocalData; -import java.util.ArrayList; import java.util.List; public class ReturnValueAVM2Item extends AVM2Item implements ExitItem { @@ -45,8 +44,8 @@ public class ReturnValueAVM2Item extends AVM2Item implements ExitItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnVoidAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnVoidAVM2Item.java index 11794c649..499790382 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnVoidAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ReturnVoidAVM2Item.java @@ -18,9 +18,9 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnVoidIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -41,8 +41,8 @@ public class ReturnVoidAVM2Item extends AVM2Item implements ExitItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetLocalAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetLocalAVM2Item.java index 501f4bd9e..0d22407e6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetLocalAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetLocalAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.SetLocalIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.DupIns; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.AssignmentAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -66,7 +67,7 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2Instruction ins; switch (regIndex) { case 0: @@ -90,7 +91,7 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2Instruction ins; switch (regIndex) { case 0: diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetPropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetPropertyAVM2Item.java index 855e9721e..031102dd8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetPropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/SetPropertyAVM2Item.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.SetPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.AssignmentAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -71,7 +72,7 @@ public class SetPropertyAVM2Item extends AVM2Item implements SetTypeAVM2Item, As } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, value, new AVM2Instruction(0, new SetPropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java index b9350ee00..8bac18da7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/StringAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushStringIns; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -55,7 +56,7 @@ public class StringAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new PushStringIns(), new int[]{((AVM2SourceGenerator) generator).str(value)}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java index 346a60ed6..d73ae8e9e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThisAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.GetLocal0Ins; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -48,7 +49,7 @@ public class ThisAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}, new byte[0]) ); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThrowAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThrowAVM2Item.java index c71fd2a48..33cd04066 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThrowAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/ThrowAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -52,9 +53,8 @@ public class ThrowAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } - - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java index 129e48d53..f04c35735 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/UndefinedAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushUndefinedIns; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -61,7 +62,7 @@ public class UndefinedAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new AVM2Instruction(0, new PushUndefinedIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java index 9aa9e3821..040bf4e4e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java @@ -72,12 +72,12 @@ public class DeclarationAVM2Item extends AVM2Item { writer.append("var "); return assignment.toString(writer, localData); } - + @Override public GraphTargetItem returnType() { return new TypeItem(type); - } - + } + @Override public boolean hasReturnValue() { return false; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java index 05f163ebd..e6ac8b8ba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ExceptionAVM2Item.java @@ -36,13 +36,12 @@ public class ExceptionAVM2Item extends AVM2Item { public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { return writer.append(exception.getVarName(localData.constantsAvm2, localData.fullyQualifiedNames)); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } - - + @Override public boolean hasReturnValue() { return false; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/FilterAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/FilterAVM2Item.java index f9480cf3d..ce8860f43 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/FilterAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/FilterAVM2Item.java @@ -45,12 +45,12 @@ public class FilterAVM2Item extends AVM2Item { expression.toString(writer, localData); return writer.append(")"); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } - + } + @Override public boolean hasReturnValue() { return false; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java index a710000d7..b945e2e6d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -126,16 +127,15 @@ public class ForEachInAVM2Item extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } - - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java index 6fd2a1c6d..522be1dd7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -126,14 +127,14 @@ public class ForInAVM2Item extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } - + } + @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java index 70e4d9828..993785d34 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/TryAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.script.NameAVM2Item; import com.jpexs.decompiler.flash.abc.types.ABCException; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -142,21 +143,20 @@ public class TryAVM2Item extends AVM2Item implements Block { public boolean needsSemicolon() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } - + } + @Override public boolean hasReturnValue() { return false; } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { - return ((AVM2SourceGenerator)generator).generate(localData, this); + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); } - - + } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java index 936cc5829..381881b40 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.AddIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -67,7 +68,7 @@ public class AddAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new AddIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java index 193224d18..5aa8501e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.AsTypeIns; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -32,7 +33,7 @@ public class AsTypeAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new AsTypeIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java index 68bb46db0..9e4d63b24 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.BitAndIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class BitAndAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new BitAndIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java index 94aaa95c6..e63f720fb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.BitNotIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class BitNotAVM2Item extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new AVM2Instruction(0, new BitNotIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java index ce9eb926c..f0591f85a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.BitOrIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class BitOrAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new BitOrIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java index 8ce5ff55e..6151bf61b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.BitXorIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class BitXorAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new BitXorIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java index a88e04b8c..6226a5dd5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DeletePropertyAVM2Item.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.DeletePropertyIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -50,7 +51,7 @@ public class DeletePropertyAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, new AVM2Instruction(0, new DeletePropertyIns(), new int[]{((AVM2SourceGenerator) generator).propertyName(propertyName)}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java index 45c3908ff..0f90d15e7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.DivideIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -66,7 +67,7 @@ public class DivideAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new DivideIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java index 2ae2b0f91..2ca232bd5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -46,9 +47,6 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public InstructionDefinition getIfNotDefinition() { return new IfNeIns(); } - - - @Override public Object getResult() { @@ -61,7 +59,7 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new EqualsIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index 24bc6b317..5615da3b5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterEquals import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -46,9 +47,7 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public InstructionDefinition getIfNotDefinition() { return new IfNGeIns(); } - - - + @Override public GraphTargetItem invert() { return new LtAVM2Item(src, leftSide, rightSide); @@ -67,7 +66,7 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new GreaterEqualsIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index 25b0bd6be..1e721a83e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterThanIn import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfGtIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNGtIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -31,12 +32,12 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public GtAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); } - + @Override public InstructionDefinition getIfDefinition() { return new IfGtIns(); @@ -46,8 +47,6 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio public InstructionDefinition getIfNotDefinition() { return new IfNGtIns(); } - - @Override public GraphTargetItem invert() { @@ -60,7 +59,7 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new GreaterThanIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IfCondition.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IfCondition.java index 9ef029308..c33bd239f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IfCondition.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IfCondition.java @@ -14,7 +14,6 @@ * 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.model.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -24,7 +23,9 @@ import com.jpexs.decompiler.graph.model.BinaryOp; * * @author JPEXS */ -public interface IfCondition extends BinaryOp{ +public interface IfCondition extends BinaryOp { + public InstructionDefinition getIfDefinition(); + public InstructionDefinition getIfNotDefinition(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java index f2fd54f98..85b58f670 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.InIns; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -33,7 +34,7 @@ public class InAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new InIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java index 07eaee944..5f683ced1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.InstanceOfIns; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -33,7 +34,7 @@ public class InstanceOfAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new InstanceOfIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java index 6831207dd..b4e2764b1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.IsTypeIns; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -33,7 +34,7 @@ public class IsTypeAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new IsTypeIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java index a17da5171..8caeea3a1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.LShiftIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class LShiftAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new LShiftIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index c90ce7ba0..434db80eb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessEqualsIns import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -31,7 +32,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public LeAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); @@ -46,9 +47,7 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio public InstructionDefinition getIfNotDefinition() { return new IfNLeIns(); } - - - + @Override public GraphTargetItem invert() { return new GtAVM2Item(src, leftSide, rightSide); @@ -67,7 +66,7 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new LessEqualsIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index cfefe83c3..7181fb260 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessThanIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfLtIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNLtIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -31,7 +32,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public LtAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); @@ -46,9 +47,7 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio public InstructionDefinition getIfNotDefinition() { return new IfNLtIns(); } - - - + @Override public GraphTargetItem invert() { return new GeAVM2Item(src, leftSide, rightSide); @@ -60,7 +59,7 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditio } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new LessThanIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java index 3c0418d3e..efee63016 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.ModuloIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -66,7 +67,7 @@ public class ModuloAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new ModuloIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java index cb29e7f26..c050fe8b3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.MultiplyIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class MultiplyAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new MultiplyIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java index f34eea505..f7ec96b8e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.NegateIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class NegAVM2Item extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new AVM2Instruction(0, new NegateIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java index 06ca4d890..8f0f2b89a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfEqIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfNeIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -32,12 +33,12 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public NeqAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); } - + @Override public InstructionDefinition getIfDefinition() { return new IfNeIns(); @@ -47,7 +48,6 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditi public InstructionDefinition getIfNotDefinition() { return new IfEqIns(); } - @Override public Object getResult() { @@ -60,7 +60,7 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfConditi } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new EqualsIns(), new int[]{}, new byte[0]), new AVM2Instruction(0, new NotIns(), new int[]{}, new byte[0]) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java index 7ebf87de4..6f13ea511 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.AssignmentAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class PreDecrementAVM2Item extends UnaryOpItem implements AssignmentAVM2I } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (value instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) value).toSourceChange(localData, generator, false, true, true); } @@ -47,13 +48,13 @@ public class PreDecrementAVM2Item extends UnaryOpItem implements AssignmentAVM2I } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (value instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) value).toSourceChange(localData, generator, false, true, false); } return new ArrayList<>(); //? } - + @Override public GraphTargetItem returnType() { return value.returnType(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java index 25090bb54..e84c25715 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,7 +39,7 @@ public class PreIncrementAVM2Item extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (value instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) value).toSourceChange(localData, generator, false, false, true); } @@ -46,7 +47,7 @@ public class PreIncrementAVM2Item extends UnaryOpItem { } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (value instanceof AssignableAVM2Item) { return ((AssignableAVM2Item) value).toSourceChange(localData, generator, false, false, false); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java index eba862c61..a5fc92ac8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.RShiftIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class RShiftAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new RShiftIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java index 8b17b589d..c11593681 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsI 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.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -31,7 +32,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public StrictEqAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); @@ -46,9 +47,7 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCo public InstructionDefinition getIfNotDefinition() { return new IfStrictNeIns(); } - - - + @Override public Object getResult() { Object x = leftSide.getResult(); @@ -63,7 +62,7 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCo } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new StrictEqualsIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java index 846cc9e2d..4a10c3b3a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsI 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.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -32,12 +33,12 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; import java.util.List; -public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfCondition { +public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { public StrictNeqAVM2Item(GraphSourceItem instruction, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); } - + @Override public InstructionDefinition getIfDefinition() { return new IfStrictNeIns(); @@ -47,8 +48,6 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfC public InstructionDefinition getIfNotDefinition() { return new IfStrictEqIns(); } - - @Override public GraphTargetItem invert() { @@ -64,7 +63,7 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem,IfC } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new StrictEqualsIns(), new int[]{}, new byte[0]), new AVM2Instruction(0, new NotIns(), new int[]{}, new byte[0]) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java index 5ebe73c0a..d1b84f1be 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.SubtractIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class SubtractAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new SubtractIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java index efbd4e712..e750242c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.TypeOfIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.EcmaType; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -68,7 +69,7 @@ public class TypeOfAVM2Item extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new AVM2Instruction(0, new TypeOfIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java index 1b08ca213..f61e8f47b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.URShiftIns; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -39,7 +40,7 @@ public class URShiftAVM2Item extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new AVM2Instruction(0, new URShiftIns(), new int[]{}, new byte[0]) ); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 39956e048..0b6e985af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.ConstructSu import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewActivationIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewCatchIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewClassIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewFunctionIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfFalseIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfStrictNeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.jumps.IfTrueIns; @@ -86,6 +87,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.Traits; import com.jpexs.decompiler.flash.action.swf5.ActionPushDuplicate; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -133,7 +135,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, AndItem item) { + public List generate(SourceGeneratorLocalData localData, AndItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); ret.add(new ActionPushDuplicate()); @@ -163,7 +165,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, OrItem item) { + public List generate(SourceGeneratorLocalData localData, OrItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); ret.add(new ActionPushDuplicate()); @@ -192,7 +194,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return list; } - private List condition(SourceGeneratorLocalData localData, GraphTargetItem t, int offset) { + private List condition(SourceGeneratorLocalData localData, GraphTargetItem t, int offset) throws CompilationException { if (t instanceof IfCondition) { IfCondition ic = (IfCondition) t; return GraphTargetItem.toSourceMerge(localData, this, ic.getLeftSide(), ic.getRightSide(), ins(ic.getIfDefinition(), offset)); @@ -200,7 +202,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return GraphTargetItem.toSourceMerge(localData, this, t, ins(new IfTrueIns(), offset)); } - private List notCondition(SourceGeneratorLocalData localData, GraphTargetItem t, int offset) { + private List notCondition(SourceGeneratorLocalData localData, GraphTargetItem t, int offset) throws CompilationException { if (t instanceof IfCondition) { IfCondition ic = (IfCondition) t; return GraphTargetItem.toSourceMerge(localData, this, ic.getLeftSide(), ic.getRightSide(), ins(ic.getIfNotDefinition(), offset)); @@ -208,7 +210,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return GraphTargetItem.toSourceMerge(localData, this, t, ins(new IfFalseIns(), offset)); } - private List generateIf(SourceGeneratorLocalData localData, GraphTargetItem expression, List onTrueCmds, List onFalseCmds, boolean ternar) { + private List generateIf(SourceGeneratorLocalData localData, GraphTargetItem expression, List onTrueCmds, List onFalseCmds, boolean ternar) throws CompilationException { List ret = new ArrayList<>(); //ret.addAll(notCondition(localData, expression)); List onTrue = null; @@ -216,14 +218,14 @@ public class AVM2SourceGenerator implements SourceGenerator { if (ternar) { onTrue = toInsList(onTrueCmds.get(0).toSource(localData, this)); } else { - onTrue = generateToActionList(localData, onTrueCmds); + onTrue = generateToInsList(localData, onTrueCmds); } if (onFalseCmds != null && !onFalseCmds.isEmpty()) { if (ternar) { onFalse = toInsList(onFalseCmds.get(0).toSource(localData, this)); } else { - onFalse = generateToActionList(localData, onFalseCmds); + onFalse = generateToInsList(localData, onFalseCmds); } } AVM2Instruction ajmp = null; @@ -254,7 +256,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, IfItem item) { + public List generate(SourceGeneratorLocalData localData, IfItem item) throws CompilationException { return generateIf(localData, item.expression, item.onTrue, item.onFalse, false); } @@ -283,7 +285,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, TernarOpItem item) { + public List generate(SourceGeneratorLocalData localData, TernarOpItem item) throws CompilationException { List onTrue = new ArrayList<>(); onTrue.add(item.onTrue); List onFalse = new ArrayList<>(); @@ -292,7 +294,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, WhileItem item) { + public List generate(SourceGeneratorLocalData localData, WhileItem item) throws CompilationException { List ret = new ArrayList<>(); List whileExpr = new ArrayList<>(); @@ -305,9 +307,9 @@ public class AVM2SourceGenerator implements SourceGenerator { ex.addAll(cei.commands); lastItem = ex.remove(ex.size() - 1); } - whileExpr.addAll(generateToActionList(localData, ex)); + whileExpr.addAll(generateToInsList(localData, ex)); } - List whileBody = generateToActionList(localData, item.commands); + List whileBody = generateToInsList(localData, item.commands); AVM2Instruction forwardJump = ins(new JumpIns(), 0); ret.add(forwardJump); whileBody.add(0, ins(new LabelIns())); @@ -322,15 +324,15 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - public List generate(SourceGeneratorLocalData localData, ForEachInAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, ForEachInAVM2Item item) throws CompilationException { return generateForIn(localData, item.expression.collection, (AssignableAVM2Item) item.expression.object, item.commands, true); } - public List generate(SourceGeneratorLocalData localData, ForInAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, ForInAVM2Item item) throws CompilationException { return generateForIn(localData, item.expression.collection, (AssignableAVM2Item) item.expression.object, item.commands, false); } - public List generateForIn(SourceGeneratorLocalData localData, GraphTargetItem collection, AssignableAVM2Item assignable, List commands, final boolean each) { + public List generateForIn(SourceGeneratorLocalData localData, GraphTargetItem collection, AssignableAVM2Item assignable, List commands, final boolean each) throws CompilationException { List ret = new ArrayList<>(); final Reference counterReg = new Reference<>(0); final Reference collectionReg = new Reference<>(0); @@ -361,7 +363,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, AssignableAVM2Item.getTemp(localData, generator, collectionReg), AssignableAVM2Item.getTemp(localData, generator, counterReg), @@ -376,7 +378,7 @@ public class AVM2SourceGenerator implements SourceGenerator { assignable.toSourceIgnoreReturnValue(localData, this) )); - forBody.addAll(generateToActionList(localData, commands)); + forBody.addAll(generateToInsList(localData, commands)); int forBodyLen = insToBytes(forBody).length; AVM2Instruction forwardJump = ins(new JumpIns(), forBodyLen); @@ -397,7 +399,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, DoWhileItem item) { + public List generate(SourceGeneratorLocalData localData, DoWhileItem item) throws CompilationException { List ret = new ArrayList<>(); List whileExpr = new ArrayList<>(); @@ -410,9 +412,9 @@ public class AVM2SourceGenerator implements SourceGenerator { ex.addAll(cei.commands); lastItem = ex.remove(ex.size() - 1); } - whileExpr.addAll(generateToActionList(localData, ex)); + whileExpr.addAll(generateToInsList(localData, ex)); } - List dowhileBody = generateToActionList(localData, item.commands); + List dowhileBody = generateToInsList(localData, item.commands); List labelBody = new ArrayList<>(); labelBody.add(ins(new LabelIns())); int labelBodyLen = insToBytes(labelBody).length; @@ -431,7 +433,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, ForItem item) { + public List generate(SourceGeneratorLocalData localData, ForItem item) throws CompilationException { List ret = new ArrayList<>(); List forExpr = new ArrayList<>(); @@ -446,12 +448,12 @@ public class AVM2SourceGenerator implements SourceGenerator { ex.addAll(cei.commands); lastItem = ex.remove(ex.size() - 1); } - forExpr.addAll(generateToActionList(localData, ex)); + forExpr.addAll(generateToInsList(localData, ex)); } - List forBody = generateToActionList(localData, item.commands); - List forFinalCommands = generateToActionList(localData, item.finalCommands); + List forBody = generateToInsList(localData, item.commands); + List forFinalCommands = generateToInsList(localData, item.finalCommands); - ret.addAll(generateToActionList(localData, item.firstCommands)); + ret.addAll(generateToInsList(localData, item.firstCommands)); AVM2Instruction forwardJump = ins(new JumpIns(), 0); ret.add(forwardJump); @@ -476,7 +478,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, SwitchItem item) { + public List generate(SourceGeneratorLocalData localData, SwitchItem item) throws CompilationException { List ret = new ArrayList<>(); Reference switchedReg = new Reference<>(0); AVM2Instruction forwardJump = ins(new JumpIns(), 0); @@ -515,12 +517,12 @@ public class AVM2SourceGenerator implements SourceGenerator { List bodiesOffsets = new ArrayList<>(); int defOffset; int casesLen = insToBytes(cases).length; - bodies.addAll(generateToActionList(localData, item.defaultCommands)); + bodies.addAll(generateToInsList(localData, item.defaultCommands)); bodies.add(0, ins(new LabelIns())); bodies.add(ins(new BreakJumpIns(item.loop.id), 0)); //There could be two breaks when default clause ends with break, but official compiler does this too, so who cares... defOffset = -(insToBytes(bodies).length + casesLen); for (int i = item.caseCommands.size() - 1; i >= 0; i--) { - bodies.addAll(0, generateToActionList(localData, item.caseCommands.get(i))); + bodies.addAll(0, generateToInsList(localData, item.caseCommands.get(i))); bodies.add(0, ins(new LabelIns())); bodiesOffsets.add(0, -(insToBytes(bodies).length + casesLen)); } @@ -540,7 +542,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, NotItem item) { + public List generate(SourceGeneratorLocalData localData, NotItem item) throws CompilationException { /*if (item.getOriginal() instanceof Inverted) { GraphTargetItem norig = ((Inverted) item).invert(); return norig.toSource(localData, this); @@ -566,14 +568,11 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - private List shiftExc(List list, int shift) { - for (AVM2Instruction ins : list) { - if (ins instanceof ExceptionMarkAVM2Instruction) { - ExceptionMarkAVM2Instruction e = (ExceptionMarkAVM2Instruction) ins; - e.exceptionId += shift; - } - } - return list; + public List generate(SourceGeneratorLocalData localData, FunctionAVM2Item item) throws CompilationException { + List ret = new ArrayList<>(); + ret.add(ins(new NewFunctionIns(), method(localData.callStack, localData.pkg, item.needsActivation, item.subvariables, 0 /*Set later*/, item.hasRest, item.line, null, null, false, localData, item.paramTypes, item.paramNames, item.paramValues, item.body, item.retType))); + + return ret; } private static int currentFinId = 1; @@ -582,7 +581,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return currentFinId++; } - public List generate(SourceGeneratorLocalData localData, TryAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, TryAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); boolean newFinallyReg = false; @@ -621,10 +620,10 @@ public class AVM2SourceGenerator implements SourceGenerator { if (finallyEx > -1) { localData.finallyCatches.add(finId); } - List tryCmds = generateToActionList(localData, item.tryCommands); + List tryCmds = generateToInsList(localData, item.tryCommands); List> catchCmds = new ArrayList<>(); for (int c = 0; c < item.catchCommands.size(); c++) { - catchCmds.add(generateToActionList(localData, item.catchCommands.get(c))); + catchCmds.add(generateToInsList(localData, item.catchCommands.get(c))); } firstId = localData.exceptions.size(); @@ -755,7 +754,7 @@ public class AVM2SourceGenerator implements SourceGenerator { defPos = cnt; cnt++; //Skip default clause (throw) localData.finallyCounter.put(finId, cnt); - finallySwitchCmds.addAll(generateToActionList(localData, item.finallyCommands)); + finallySwitchCmds.addAll(generateToInsList(localData, item.finallyCommands)); killRegister(localData, localData.finallyRegister); localData.finallyRegister = oldReg; finSwitchLen = insToBytes(finallySwitchCmds).length; @@ -856,7 +855,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - public List generate(SourceGeneratorLocalData localData, ReturnValueAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, ReturnValueAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(item.value.toSource(localData, this)); if (!localData.finallyCatches.isEmpty()) { @@ -886,7 +885,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - public List generate(SourceGeneratorLocalData localData, ReturnVoidAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, ReturnVoidAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); if (!localData.finallyCatches.isEmpty()) { @@ -912,23 +911,23 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - public List generate(SourceGeneratorLocalData localData, ThrowAVM2Item item) { + public List generate(SourceGeneratorLocalData localData, ThrowAVM2Item item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(item.value.toSource(localData, this)); ret.add(ins(new ThrowIns())); return ret; } - private List generateToActionList(SourceGeneratorLocalData localData, List commands) { + private List generateToInsList(SourceGeneratorLocalData localData, List commands) throws CompilationException { return toInsList(generate(localData, commands)); } - private List generateToActionList(SourceGeneratorLocalData localData, GraphTargetItem command) { + private List generateToActionList(SourceGeneratorLocalData localData, GraphTargetItem command) throws CompilationException { return toInsList(command.toSource(localData, this)); } @Override - public List generate(SourceGeneratorLocalData localData, List commands) { + public List generate(SourceGeneratorLocalData localData, List commands) throws CompilationException { List ret = new ArrayList<>(); for (GraphTargetItem item : commands) { ret.addAll(item.toSourceIgnoreReturnValue(localData, this)); @@ -989,7 +988,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return abc; } - public void generateClass(int namespace, int initScope, PackageAVM2Item pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List traitItems) throws ParseException { + public void generateClass(int namespace, int initScope, PackageAVM2Item pkg, ClassInfo classInfo, InstanceInfo instanceInfo, SourceGeneratorLocalData localData, boolean isInterface, String name, String superName, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List traitItems) throws ParseException, CompilationException { localData.currentClass = pkg.packageName.isEmpty() ? name : pkg.packageName + "." + name; List ret = new ArrayList<>(); if (extendsVal == null && !isInterface) { @@ -1002,10 +1001,10 @@ public class AVM2SourceGenerator implements SourceGenerator { generateTraitsPhase2(initScope, pkg, name, superName, false, localData, traitItems, instanceInfo.instance_traits, it); generateTraitsPhase2(initScope, pkg, name, superName, true, localData, traitItems, classInfo.static_traits, st); if (constructor == null) { - instanceInfo.iinit_index = method(pkg.packageName, false, new ArrayList(), initScope + 1, false, 0, name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), TypeItem.UNBOUNDED/*?? FIXME*/); + instanceInfo.iinit_index = method(new ArrayList(), pkg.packageName, false, new ArrayList(), initScope + 1, false, 0, name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), TypeItem.UNBOUNDED/*?? FIXME*/); } else { MethodAVM2Item m = (MethodAVM2Item) constructor; - instanceInfo.iinit_index = method(pkg.packageName, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/); + instanceInfo.iinit_index = method(new ArrayList(), pkg.packageName, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/); } //Class initializer @@ -1043,7 +1042,7 @@ public class AVM2SourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item) { + public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item) throws CompilationException { if (item.commands.isEmpty()) { return new ArrayList<>(); } @@ -1057,7 +1056,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return ret; } - public int generateClass(int namespace, ClassInfo ci, InstanceInfo ii, int initScope, PackageAVM2Item pkg, SourceGeneratorLocalData localData, AVM2Item cls) throws ParseException { + public int generateClass(int namespace, ClassInfo ci, InstanceInfo ii, int initScope, PackageAVM2Item pkg, SourceGeneratorLocalData localData, AVM2Item cls) throws ParseException, CompilationException { /*ClassInfo ci = new ClassInfo(); InstanceInfo ii = new InstanceInfo(); abc.class_info.add(ci); @@ -1088,16 +1087,21 @@ public class AVM2SourceGenerator implements SourceGenerator { return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(var), namespace, 0, 0, new ArrayList()), true); } - public int typeName(SourceGeneratorLocalData localData, GraphTargetItem type) { + public int typeName(SourceGeneratorLocalData localData, GraphTargetItem type) throws CompilationException { if (type instanceof UnboundedTypeItem) { return 0; } + if (type instanceof UnresolvedAVM2Item) { + type = ((UnresolvedAVM2Item) type).resolve(new ArrayList(), new ArrayList(), abc, allABCs, new ArrayList(), new ArrayList()); + } + String pkg = ""; String name = type.toString(); if ("*".equals(name)) { return 0; } + TypeItem nameItem = (TypeItem) type; if (name.contains(".")) { pkg = name.substring(0, name.lastIndexOf('.')); @@ -1186,46 +1190,25 @@ public class AVM2SourceGenerator implements SourceGenerator { return false; } - public int method(String pkg, boolean needsActivation, List subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List paramTypes, List paramNames, List paramValues, List body, GraphTargetItem retType) throws ParseException { + public int method(List callStack, String pkg, boolean needsActivation, List subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List paramTypes, List paramNames, List paramValues, List body, GraphTargetItem retType) throws CompilationException { //Reference hasArgs = new Reference<>(Boolean.FALSE); //calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs); + int oldActivationReg = localData.activationReg; localData.activationReg = 0; - for (NameAVM2Item n : subvariables) { - if (n.unresolved) { - GraphTargetItem resolved = null; - List abcs = new ArrayList<>(); - abcs.add(abc); - abcs.addAll(allABCs); - - for (int i = 0; i < n.openedNamespaces.size(); i++) { - int nsIndex = n.openedNamespaces.get(i); - Namespace ns = abc.constants.constant_namespace.get(nsIndex); - int nsKind = ns.kind; - loopabc: - for (ABC a : abcs) { - for (int h = 0; h < a.instance_info.size(); h++) { - InstanceInfo ii = a.instance_info.get(h); - Multiname nm = a.constants.constant_multiname.get(ii.name_index); - if (nm.getNamespace(a.constants).getName(a.constants).equals(ns.getName(abc.constants)) && nm.getNamespace(a.constants).kind == nsKind) { - - //found opened class - Reference outName = new Reference<>(""); - Reference outNs = new Reference<>(""); - Reference outPropNs = new Reference<>(""); - Reference outPropNsKind = new Reference<>(1); - Reference outPropType = new Reference<>(""); - if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, nm.getNamespace(a.constants).getName(a.constants), nm.getName(a.constants, new ArrayList()), n.getVariableName(), outName, outNs, outPropNs, outPropNsKind, outPropType)) { - resolved = new PropertyAVM2Item(null, n.getVariableName(), n.getIndex(), abc, allABCs, n.openedNamespaces); - } - } - } + for (int i = 0; i < subvariables.size(); i++) { + AssignableAVM2Item an = subvariables.get(i); + if (an instanceof UnresolvedAVM2Item) { + UnresolvedAVM2Item n = (UnresolvedAVM2Item) an; + if (n.resolved == null) { + GraphTargetItem res = n.resolve(paramTypes, paramNames, abc, allABCs, callStack, subvariables); + if (res instanceof AssignableAVM2Item) { + subvariables.set(i, (AssignableAVM2Item) res); + } else { + subvariables.remove(i); + i--; } } - n.redirect = resolved; - if (resolved == null) { - throw new ParseException("Unknown variable or property:" + n.getVariableName(), n.line); - } } } @@ -1237,8 +1220,13 @@ public class AVM2SourceGenerator implements SourceGenerator { List registerNames = new ArrayList<>(); List registerTypes = new ArrayList<>(); - registerTypes.add(pkg.isEmpty() ? className : pkg + "." + className); - registerNames.add("this"); + if (className != null) { + registerTypes.add(pkg.isEmpty() ? className : pkg + "." + className); + registerNames.add("this"); + } else { + registerTypes.add("*"); + registerNames.add("--nothis"); + } for (GraphTargetItem t : paramTypes) { registerTypes.add(t.toString()); slotTypes.add(t.toString()); @@ -1246,12 +1234,15 @@ public class AVM2SourceGenerator implements SourceGenerator { registerNames.addAll(paramNames); slotNames.addAll(paramNames); localData.registerVars.clear(); - for (NameAVM2Item n : subvariables) { - if (n.getVariableName().equals("arguments") & !n.isDefinition()) { - registerNames.add("arguments"); - registerTypes.add("Object"); - hasArguments = true; - break; + for (AssignableAVM2Item an : subvariables) { + if (an instanceof NameAVM2Item) { + NameAVM2Item n = (NameAVM2Item) an; + if (n.getVariableName().equals("arguments") & !n.isDefinition()) { + registerNames.add("arguments"); + registerTypes.add("Object"); + hasArguments = true; + break; + } } } int paramRegCount = registerNames.size(); @@ -1261,28 +1252,34 @@ public class AVM2SourceGenerator implements SourceGenerator { localData.activationReg = registerNames.size() - 1; registerTypes.add("Object"); } - for (NameAVM2Item n : subvariables) { - if (n.isDefinition()) { - if (!needsActivation || (n.getSlotScope() <= 0)) { - registerNames.add(n.getVariableName()); - registerTypes.add(n.type.toString()); - slotNames.add(n.getVariableName()); - slotTypes.add(n.type.toString()); + for (AssignableAVM2Item an : subvariables) { + if (an instanceof NameAVM2Item) { + NameAVM2Item n = (NameAVM2Item) an; + if (n.isDefinition()) { + if (!needsActivation || (n.getSlotScope() <= 0)) { + registerNames.add(n.getVariableName()); + registerTypes.add(n.type.toString()); + slotNames.add(n.getVariableName()); + slotTypes.add(n.type.toString()); + } } } } - int slotScope = 1; //? + int slotScope = className == null ? 0 : 1; - for (NameAVM2Item n : subvariables) { - if (n.getVariableName() != null) { - if (needsActivation) { - if (n.getSlotNumber() <= 0) { - n.setSlotNumber(slotNames.indexOf(n.getVariableName())); - n.setSlotScope(slotScope); + for (AssignableAVM2Item an : subvariables) { + if (an instanceof NameAVM2Item) { + NameAVM2Item n = (NameAVM2Item) an; + if (n.getVariableName() != null) { + if (needsActivation) { + if (n.getSlotNumber() <= 0) { + n.setSlotNumber(slotNames.indexOf(n.getVariableName())); + n.setSlotScope(slotScope); + } + } else { + n.setRegNumber(registerNames.indexOf(n.getVariableName())); } - } else { - n.setRegNumber(registerNames.indexOf(n.getVariableName())); } } } @@ -1295,57 +1292,58 @@ public class AVM2SourceGenerator implements SourceGenerator { } List declarations = new ArrayList<>(); loopn: - for (NameAVM2Item n : subvariables) { - //if (!n.isDefinition()) { - // continue; - //} + for (AssignableAVM2Item an : subvariables) { + if (an instanceof NameAVM2Item) { + NameAVM2Item n = (NameAVM2Item) an; - if (needsActivation) { - if (n.getSlotScope() != slotScope) { - continue; - } else { - if (n.getSlotNumber() < paramRegCount) { + if (needsActivation) { + if (n.getSlotScope() != slotScope) { continue; + } else { + if (n.getSlotNumber() < paramRegCount) { + continue; + } } } - } - for (NameAVM2Item d : declarations) { - if (n.getVariableName() != null && n.getVariableName().equals(d.getVariableName())) { - continue loopn; - } - } - for (GraphTargetItem it : body) { //search first level of commands - if (it instanceof NameAVM2Item) { - NameAVM2Item n2 = (NameAVM2Item) it; - if (n2.isDefinition() && n2.getAssignedValue() != null && n2.getVariableName().equals(n.getVariableName())) { + for (NameAVM2Item d : declarations) { + if (n.getVariableName() != null && n.getVariableName().equals(d.getVariableName())) { continue loopn; } - if (!n2.isDefinition() && n2.getVariableName() != null && n2.getVariableName().equals(n.getVariableName())) { //used earlier than defined - break; + } + + for (GraphTargetItem it : body) { //search first level of commands + if (it instanceof NameAVM2Item) { + NameAVM2Item n2 = (NameAVM2Item) it; + if (n2.isDefinition() && n2.getAssignedValue() != null && n2.getVariableName().equals(n.getVariableName())) { + continue loopn; + } + if (!n2.isDefinition() && n2.getVariableName() != null && n2.getVariableName().equals(n.getVariableName())) { //used earlier than defined + break; + } } } - } - if (n.unresolved) { - continue; - } - if (n.redirect != null) { - continue; - } - if (n.getNs() != null) { - continue; - } - - NameAVM2Item d = new NameAVM2Item(n.type, n.line, n.getVariableName(), NameAVM2Item.getDefaultValue("" + n.type), true, n.openedNamespaces); - //no index - if (needsActivation) { - if (d.getSlotNumber() <= 0) { - d.setSlotNumber(n.getSlotNumber()); - d.setSlotScope(n.getSlotScope()); + if (n.unresolved) { + continue; } - } else { - d.setRegNumber(n.getRegNumber()); + if (n.redirect != null) { + continue; + } + if (n.getNs() != null) { + continue; + } + + NameAVM2Item d = new NameAVM2Item(n.type, n.line, n.getVariableName(), NameAVM2Item.getDefaultValue("" + n.type), true, n.openedNamespaces); + //no index + if (needsActivation) { + if (d.getSlotNumber() <= 0) { + d.setSlotNumber(n.getSlotNumber()); + d.setSlotScope(n.getSlotScope()); + } + } else { + d.setRegNumber(n.getRegNumber()); + } + declarations.add(d); } - declarations.add(d); } int param_types[] = new int[paramTypes.size()]; @@ -1377,7 +1375,6 @@ public class AVM2SourceGenerator implements SourceGenerator { } MethodBody mbody = new MethodBody(); - mbody.method_info = abc.addMethodInfo(mi); if (needsActivation) { mbody.traits = new Traits(); @@ -1401,11 +1398,32 @@ public class AVM2SourceGenerator implements SourceGenerator { body.addAll(0, declarations); localData.exceptions = new ArrayList<>(); + localData.callStack.add(mbody); List src = generate(localData, body); + + mbody.method_info = abc.addMethodInfo(mi); + mi.setBody(mbody); mbody.code = new AVM2Code(); mbody.code.code = toInsList(src); if (needsActivation) { + if (localData.traitUsages.containsKey(mbody)) { + List usages = localData.traitUsages.get(mbody); + for (int i = 0; i < mbody.traits.traits.size(); i++) { + if (usages.contains(i)) { + TraitSlotConst tsc = (TraitSlotConst) mbody.traits.traits.get(i); + GraphTargetItem type = TypeItem.UNBOUNDED; + if (tsc.type_index > 0) { + type = new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants)); + } + NameAVM2Item d = new NameAVM2Item(type, 0, tsc.getName(abc).getName(abc.constants, new ArrayList()), NameAVM2Item.getDefaultValue("" + type), true, new ArrayList()); + d.setSlotNumber(tsc.slot_id); + d.setSlotScope(slotScope); + mbody.code.code.addAll(0, toInsList(d.toSourceIgnoreReturnValue(localData, this))); + } + } + } + List acts = new ArrayList<>(); acts.add(ins(new NewActivationIns())); acts.add(ins(new DupIns())); @@ -1435,7 +1453,7 @@ public class AVM2SourceGenerator implements SourceGenerator { if (ins.definition instanceof ConstructSuperIns) { ac = ins.operands[0]; if (parentConsAC != ac) { - throw new ParseException("Parent constructor call requires different number of arguments", line); + throw new CompilationException("Parent constructor call requires different number of arguments", line); } } @@ -1446,20 +1464,24 @@ public class AVM2SourceGenerator implements SourceGenerator { mbody.code.code.add(1, new AVM2Instruction(0, new ConstructSuperIns(), new int[]{0}, new byte[0])); } else { - throw new ParseException("Parent constructor must be called", line); + throw new CompilationException("Parent constructor must be called", line); } } } - mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}, new byte[0])); - mbody.code.code.add(1, new AVM2Instruction(0, new PushScopeIns(), new int[]{}, new byte[0])); + if (className != null) {//It's method, not (inner) function + mbody.code.code.add(0, new AVM2Instruction(0, new GetLocal0Ins(), new int[]{}, new byte[0])); + mbody.code.code.add(1, new AVM2Instruction(0, new PushScopeIns(), new int[]{}, new byte[0])); + } - InstructionDefinition lastDef = mbody.code.code.get(mbody.code.code.size() - 1).definition; - if (!((lastDef instanceof ReturnVoidIns) || (lastDef instanceof ReturnValueIns))) { - if (retType.toString().equals("*") || retType.toString().equals("void") || constructor) { - mbody.code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[]{}, new byte[0])); - } else { - mbody.code.code.add(new AVM2Instruction(0, new PushUndefinedIns(), new int[]{}, new byte[0])); - mbody.code.code.add(new AVM2Instruction(0, new ReturnValueIns(), new int[]{}, new byte[0])); + if (!mbody.code.code.isEmpty()) { + InstructionDefinition lastDef = mbody.code.code.get(mbody.code.code.size() - 1).definition; + if (!((lastDef instanceof ReturnVoidIns) || (lastDef instanceof ReturnValueIns))) { + if (retType.toString().equals("*") || retType.toString().equals("void") || constructor) { + mbody.code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[]{}, new byte[0])); + } else { + mbody.code.code.add(new AVM2Instruction(0, new PushUndefinedIns(), new int[]{}, new byte[0])); + mbody.code.code.add(new AVM2Instruction(0, new ReturnValueIns(), new int[]{}, new byte[0])); + } } } mbody.exceptions = localData.exceptions.toArray(new ABCException[localData.exceptions.size()]); @@ -1487,9 +1509,10 @@ public class AVM2SourceGenerator implements SourceGenerator { } mbody.autoFillStats(abc, initScope); - abc.addMethodBody(mbody); - //TODO: Exceptions + + localData.callStack.remove(mbody); + localData.activationReg = oldActivationReg; return mbody.method_info; } @@ -1538,7 +1561,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return null; } - public void generateTraitsPhase2(int initScope, PackageAVM2Item pkg, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Trait[] traits) throws ParseException { + public void generateTraitsPhase2(int initScope, PackageAVM2Item pkg, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts, Trait[] traits) throws ParseException, CompilationException { //Note: Names must be generated first before accesed in inner subs for (int k = 0; k < items.size(); k++) { GraphTargetItem item = items.get(k); @@ -1557,15 +1580,15 @@ public class AVM2SourceGenerator implements SourceGenerator { if (mai.isStatic() != generateStatic) { continue; } - ((TraitMethodGetterSetter) traits[k]).method_info = method(pkg.packageName, mai.needsActivation, mai.subvariables, initScope + 1/*class scope*/, mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType); + ((TraitMethodGetterSetter) traits[k]).method_info = method(new ArrayList(), pkg.packageName, mai.needsActivation, mai.subvariables, initScope + 1/*class scope*/, mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType); } else if (item instanceof FunctionAVM2Item) { FunctionAVM2Item fai = (FunctionAVM2Item) item; - ((TraitFunction) traits[k]).method_info = method(pkg.packageName, fai.needsActivation, fai.subvariables, initScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType); + ((TraitFunction) traits[k]).method_info = method(new ArrayList(), pkg.packageName, fai.needsActivation, fai.subvariables, initScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType); } } } - public Trait[] generateTraitsPhase1(PackageAVM2Item pkg, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts) throws ParseException { + public Trait[] generateTraitsPhase1(PackageAVM2Item pkg, String className, String superName, boolean generateStatic, SourceGeneratorLocalData localData, List items, Traits ts) throws ParseException, CompilationException { Trait[] traits = new Trait[items.size()]; int slot_id = 1; for (int k = 0; k < items.size(); k++) { @@ -1641,7 +1664,7 @@ public class AVM2SourceGenerator implements SourceGenerator { isStatic = cai.isStatic(); } tsc.name_index = traitName(namespace, var); - tsc.type_index = isNamespace ? 0 : typeName(localData, type); + tsc.type_index = isNamespace ? 0 : (type == null ? 0 : typeName(localData, type)); ValueKind vk = getValueKind(abc.constants.constant_namespace.get(namespace).kind, type, val); if (vk == null) { @@ -1685,7 +1708,7 @@ public class AVM2SourceGenerator implements SourceGenerator { return traits; } - public ScriptInfo generateScriptInfo(PackageAVM2Item pkg, SourceGeneratorLocalData localData, List commands, boolean documentClass) throws ParseException { + public ScriptInfo generateScriptInfo(PackageAVM2Item pkg, SourceGeneratorLocalData localData, List commands, boolean documentClass) throws ParseException, CompilationException { ScriptInfo si = new ScriptInfo(); Trait[] traitArr = generateTraitsPhase1(pkg, null, null, false, localData, commands, si.traits); @@ -1728,6 +1751,7 @@ public class AVM2SourceGenerator implements SourceGenerator { mb.autoFillStats(abc, documentClass ? 1 : 0); abc.addMethodBody(mb); si.init_index = mb.method_info; + localData.pkg = pkg.packageName; generateTraitsPhase2(traitScope, pkg, null, null, false, localData, commands, si.traits, traitArr); return si; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java index b008c38ed..256aace53 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java @@ -995,6 +995,7 @@ public final class ActionScriptLexer { /** * Closes the input stream. + * * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { @@ -1036,7 +1037,8 @@ public final class ActionScriptLexer { /** * Returns the current lexical state. - * @return + * + * @return */ public final int yystate() { return zzLexicalState; @@ -1053,7 +1055,8 @@ public final class ActionScriptLexer { /** * Returns the text matched by the current regular expression. - * @return + * + * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); @@ -1075,7 +1078,8 @@ public final class ActionScriptLexer { /** * Returns the length of the matched text region. - * @return + * + * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java index f2bf5a0df..03c291b30 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java @@ -71,13 +71,13 @@ import com.jpexs.decompiler.flash.abc.avm2.model.operations.SubtractAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.TypeOfAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.operations.URShiftAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; -import com.jpexs.decompiler.flash.abc.types.InstanceInfo; -import com.jpexs.decompiler.flash.abc.types.Multiname; +import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.Namespace; import com.jpexs.decompiler.flash.action.swf4.ActionIf; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.decompiler.flash.tags.Tag; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; import com.jpexs.decompiler.graph.TypeItem; @@ -129,13 +129,13 @@ public class ActionScriptParser { return uniqLast; } - private List commands(Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, ParseException { + private List commands(Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, ParseException { List ret = new ArrayList<>(); if (debugMode) { System.out.println("commands:"); } GraphTargetItem cmd = null; - while ((cmd = command(needsActivation,importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)) != null) { + while ((cmd = command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)) != null) { ret.add(cmd); } if (debugMode) { @@ -144,7 +144,7 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem type(List importedClasses, List openedNamespaces, List variables) throws IOException, ParseException { + private GraphTargetItem type(Reference needsActivation, List importedClasses, List openedNamespaces, List variables) throws IOException, ParseException { ParsedSymbol s = lex(); if (s.type == SymbolType.MULTIPLY) { return new UnboundedTypeItem(); @@ -153,20 +153,21 @@ public class ActionScriptParser { } else { lexer.pushback(s); } - return name(true, openedNamespaces, null, false, false, variables, importedClasses); + + return name(needsActivation, true, openedNamespaces, null, false, false, variables, importedClasses); } - private GraphTargetItem memberOrCall(List importedClasses, List openedNamespaces, GraphTargetItem newcmds, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { + private GraphTargetItem memberOrCall(Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem newcmds, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { ParsedSymbol s = lex(); GraphTargetItem ret = newcmds; while (s.isType(SymbolType.DOT, SymbolType.PARENT_OPEN)) { switch (s.type) { case DOT: lexer.pushback(s); - ret = member(importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = member(needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); break; case PARENT_OPEN: - ret = new CallAVM2Item(ret, call(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + ret = new CallAVM2Item(ret, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); break; } s = lex(); @@ -175,7 +176,7 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem member(List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { + private GraphTargetItem member(Reference needsActivation, List importedClasses, List openedNamespaces, GraphTargetItem obj, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { GraphTargetItem ret = obj; ParsedSymbol s = lex(); while (s.isType(SymbolType.DOT)) { @@ -185,164 +186,166 @@ public class ActionScriptParser { s = lex(); GraphTargetItem index = null; if (s.type == SymbolType.BRACKET_OPEN) { - index = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + index = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.BRACKET_CLOSE); } else { lexer.pushback(s); } - ret = new PropertyAVM2Item(ret, propName, index, abc, otherABCs, openedNamespaces); + ret = new PropertyAVM2Item(ret, propName, index, abc, otherABCs, openedNamespaces, new ArrayList()); } lexer.pushback(s); return ret; } - private GraphTargetItem name(boolean typeOnly, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables, List importedClasses) throws IOException, ParseException { + private GraphTargetItem name(Reference needsActivation, boolean typeOnly, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables, List importedClasses) throws IOException, ParseException { ParsedSymbol s = lex(); expected(s, lexer.yyline(), SymbolType.IDENTIFIER, SymbolType.THIS, SymbolType.SUPER, SymbolType.STRING_OP); - List parts = new ArrayList<>(); - parts.add(s.value.toString()); + String name = s.value.toString(); s = lex(); while (s.type == SymbolType.DOT) { s = lex(); expected(s, lexer.yyline(), SymbolType.IDENTIFIER); - parts.add(s.value.toString()); + name += "." + s.value.toString(); s = lex(); } GraphTargetItem index = null; if (s.type == SymbolType.BRACKET_OPEN) { - index = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + index = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.BRACKET_CLOSE); } else { lexer.pushback(s); } if (!typeOnly) { - for (NameAVM2Item n : variables) { - if (n.getVariableName().equals(parts.get(0))) { - NameAVM2Item ni = new NameAVM2Item(n.type, lexer.yyline(), n.getVariableName(), null, false, openedNamespaces); - variables.add(ni); - GraphTargetItem ret = ni; - if (parts.size() == 1) { - ((NameAVM2Item) ret).setIndex(index); - } - for (int i = 1; i < parts.size(); i++) { - ret = new PropertyAVM2Item(ret, parts.get(i), i == parts.size() - 1 ? index : null, abc, otherABCs, openedNamespaces); - } + /*for (NameAVM2Item n : variables) { + if (n.getVariableName().equals(parts.get(0))) { + NameAVM2Item ni = new NameAVM2Item(n.type, lexer.yyline(), n.getVariableName(), null, false, openedNamespaces); + variables.add(ni); + GraphTargetItem ret = ni; + if (parts.size() == 1) { + ((NameAVM2Item) ret).setIndex(index); + } + for (int i = 1; i < parts.size(); i++) { + ret = new PropertyAVM2Item(ret, parts.get(i), i == parts.size() - 1 ? index : null, abc, otherABCs, openedNamespaces); + } - return ret; - } - } + return ret; + } + }*/ } - List allAbcs = new ArrayList<>(); - allAbcs.add(abc); - allAbcs.addAll(otherABCs); - //search for variable in openedNamespaces - if (!typeOnly) { - for (int i = 0; i < openedNamespaces.size(); i++) { - int nsIndex = openedNamespaces.get(i); - Namespace ns = abc.constants.constant_namespace.get(nsIndex); - int nsKind = ns.kind; - loopabc: - for (ABC a : allAbcs) { - for (int h = 0; h < a.instance_info.size(); h++) { - InstanceInfo ii = a.instance_info.get(h); - Multiname n = a.constants.constant_multiname.get(ii.name_index); - if (n.getNamespace(a.constants).getName(a.constants).equals(ns.getName(abc.constants)) && n.getNamespace(a.constants).kind == nsKind) { + /*List allAbcs = new ArrayList<>(); + allAbcs.add(abc); + allAbcs.addAll(otherABCs); + //search for variable in openedNamespaces + if (!typeOnly) { + for (int i = 0; i < openedNamespaces.size(); i++) { + int nsIndex = openedNamespaces.get(i); + Namespace ns = abc.constants.constant_namespace.get(nsIndex); + int nsKind = ns.kind; + loopabc: + for (ABC a : allAbcs) { + for (int h = 0; h < a.instance_info.size(); h++) { + InstanceInfo ii = a.instance_info.get(h); + Multiname n = a.constants.constant_multiname.get(ii.name_index); + if (n.getNamespace(a.constants).getName(a.constants).equals(ns.getName(abc.constants)) && n.getNamespace(a.constants).kind == nsKind) { - //found opened class - Reference outName = new Reference<>(""); - Reference outNs = new Reference<>(""); - Reference outPropNs = new Reference<>(""); - Reference outPropNsKind = new Reference<>(1); - Reference outPropType = new Reference<>(""); - if (AVM2SourceGenerator.searchPrototypeChain(false, allAbcs, n.getNamespace(a.constants).getName(a.constants), n.getName(a.constants, new ArrayList()), parts.get(0), outName, outNs, outPropNs, outPropNsKind, outPropType)) { - return new PropertyAVM2Item(null, parts.get(0), index, abc, otherABCs, openedNamespaces); - } - } - } - } + //found opened class + Reference outName = new Reference<>(""); + Reference outNs = new Reference<>(""); + Reference outPropNs = new Reference<>(""); + Reference outPropNsKind = new Reference<>(1); + Reference outPropType = new Reference<>(""); + if (AVM2SourceGenerator.searchPrototypeChain(false, allAbcs, n.getNamespace(a.constants).getName(a.constants), n.getName(a.constants, new ArrayList()), parts.get(0), outName, outNs, outPropNs, outPropNsKind, outPropType)) { + return new PropertyAVM2Item(null, parts.get(0), index, abc, otherABCs, openedNamespaces); + } + } + } + } - } - } + } + } - //variable not found, gonna search types - String pkg = ""; - String name = null; - int foundNsKind = Namespace.KIND_PACKAGE; - int k; - loopk: - for (k = parts.size() - 1; k >= 0; k--) { + //variable not found, gonna search types + String pkg = ""; + String name = null; + int foundNsKind = Namespace.KIND_PACKAGE; + int k; + loopk: + for (k = parts.size() - 1; k >= 0; k--) { - if (typeOnly) { - if (k < parts.size() - 1) { - k = -1; - break loopk; - } - } - if (k == 0 || typeOnly) { - for (int i = 0; i < importedClasses.size(); i++) { - String iname = importedClasses.get(i); - String ipkg = ""; - if (iname.contains(".")) { - ipkg = iname.substring(0, iname.lastIndexOf('.')); - iname = iname.substring(iname.lastIndexOf('.') + 1); - } - if (iname.equals(parts.get(0))) { - k = 0; - pkg = ipkg; - name = iname; - break loopk; - } + if (typeOnly) { + if (k < parts.size() - 1) { + k = -1; + break loopk; + } + } + if (k == 0 || typeOnly) { + for (int i = 0; i < importedClasses.size(); i++) { + String iname = importedClasses.get(i); + String ipkg = ""; + if (iname.contains(".")) { + ipkg = iname.substring(0, iname.lastIndexOf('.')); + iname = iname.substring(iname.lastIndexOf('.') + 1); + } + if (iname.equals(parts.get(0))) { + k = 0; + pkg = ipkg; + name = iname; + break loopk; + } - } - } - pkg = ""; - for (int j = 0; j <= k - 1; j++) { - if (!"".equals(pkg)) { - pkg += "."; - } - pkg += parts.get(j); - } - name = parts.get(k); + } + } + pkg = ""; + for (int j = 0; j <= k - 1; j++) { + if (!"".equals(pkg)) { + pkg += "."; + } + pkg += parts.get(j); + } + name = parts.get(k); - String fname = pkg.isEmpty() ? name : pkg + "." + name; + String fname = pkg.isEmpty() ? name : pkg + "." + name; - for (ABC a : allAbcs) { - int c = a.findClassByName(fname); - if (c != -1) { - break loopk; - } - } + for (ABC a : allAbcs) { + int c = a.findClassByName(fname); + if (c != -1) { + break loopk; + } + } - for (int i = 0; i < openedNamespaces.size(); i++) { - int nsIndex = openedNamespaces.get(i); - Namespace ns = abc.constants.constant_namespace.get(nsIndex); - int nsKind = ns.kind; - String nsname = ns.getName(abc.constants); - if (nsKind == Namespace.KIND_PACKAGE) { - for (ABC a : allAbcs) { - int c = a.findClassByName(nsname.isEmpty() ? fname : nsname + "." + fname); - if (c != -1) { - pkg = nsname; - break loopk; - } - } - } - } - } + for (int i = 0; i < openedNamespaces.size(); i++) { + int nsIndex = openedNamespaces.get(i); + Namespace ns = abc.constants.constant_namespace.get(nsIndex); + int nsKind = ns.kind; + String nsname = ns.getName(abc.constants); + if (nsKind == Namespace.KIND_PACKAGE) { + for (ABC a : allAbcs) { + int c = a.findClassByName(nsname.isEmpty() ? fname : nsname + "." + fname); + if (c != -1) { + pkg = nsname; + break loopk; + } + } + } + } + } - if (k == -1) { - NameAVM2Item ret = new NameAVM2Item(null, lexer.yyline(), Helper.joinStrings(parts, "."), null, false, openedNamespaces); - ret.unresolved = true; - ret.setIndex(index); - variables.add(ret); - return ret; - //throw new ParseException("Cannot find variable or type:" + Helper.joinStrings(parts, "."), lexer.yyline()); - } - GraphTargetItem ret = new TypeItem("".equals(pkg) ? name : pkg + "." + name); - for (int i = 1; i < parts.size(); i++) { - ret = new PropertyAVM2Item(ret, parts.get(i), i == parts.size() - 1 ? index : null, abc, otherABCs, openedNamespaces); - } + if (k == -1) { + NameAVM2Item ret = new NameAVM2Item(null, lexer.yyline(), Helper.joinStrings(parts, "."), null, false, openedNamespaces); + ret.unresolved = true; + ret.setIndex(index); + variables.add(ret); + return ret; + //throw new ParseException("Cannot find variable or type:" + Helper.joinStrings(parts, "."), lexer.yyline()); + } + GraphTargetItem ret = new TypeItem("".equals(pkg) ? name : pkg + "." + name); + for (int i = 1; i < parts.size(); i++) { + ret = new PropertyAVM2Item(ret, parts.get(i), i == parts.size() - 1 ? index : null, abc, otherABCs, openedNamespaces); + }*/ + UnresolvedAVM2Item ret = new UnresolvedAVM2Item(importedClasses, typeOnly, null, lexer.yyline(), name, null, openedNamespaces); + ret.setIndex(index); + variables.add(ret); return ret; } @@ -384,7 +387,7 @@ public class ActionScriptParser { return ret; } - private List call(List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { + private List call(Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { List ret = new ArrayList<>(); //expected(SymbolType.PARENT_OPEN); //MUST BE HANDLED BY CALLER ParsedSymbol s = lex(); @@ -392,19 +395,19 @@ public class ActionScriptParser { if (s.type != SymbolType.COMMA) { lexer.pushback(s); } - ret.add(expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret.add(expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); s = lex(); expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.PARENT_CLOSE); } return ret; } - private MethodAVM2Item method(List importedClasses, boolean override, boolean isFinal, GraphTargetItem thisType, List openedNamespaces, boolean isStatic, int namespace, boolean withBody, String functionName, boolean isMethod, List variables) throws IOException, ParseException { - FunctionAVM2Item f = function(importedClasses, namespace, thisType, openedNamespaces, withBody, functionName, isMethod, variables); - return new MethodAVM2Item(f.needsActivation,f.hasRest, f.line, override, isFinal, isStatic, f.namespace, functionName, f.paramTypes, f.paramNames, f.paramValues, f.body, f.subvariables, f.retType); + private MethodAVM2Item method(Reference needsActivation, List importedClasses, boolean override, boolean isFinal, GraphTargetItem thisType, List openedNamespaces, boolean isStatic, int namespace, boolean withBody, String functionName, boolean isMethod, List variables) throws IOException, ParseException { + FunctionAVM2Item f = function(needsActivation, importedClasses, namespace, thisType, openedNamespaces, withBody, functionName, isMethod, variables); + return new MethodAVM2Item(f.needsActivation, f.hasRest, f.line, override, isFinal, isStatic, f.namespace, functionName, f.paramTypes, f.paramNames, f.paramValues, f.body, f.subvariables, f.retType); } - private FunctionAVM2Item function(List importedClasses, int namespace, GraphTargetItem thisType, List openedNamespaces, boolean withBody, String functionName, boolean isMethod, List variables) throws IOException, ParseException { + private FunctionAVM2Item function(Reference needsActivation, List importedClasses, int namespace, GraphTargetItem thisType, List openedNamespaces, boolean withBody, String functionName, boolean isMethod, List variables) throws IOException, ParseException { int line = lexer.yyline(); ParsedSymbol s; expectedType(SymbolType.PARENT_OPEN); @@ -428,13 +431,13 @@ public class ActionScriptParser { s = lex(); if (!hasRest) { if (s.type == SymbolType.COLON) { - paramTypes.add(type(importedClasses, openedNamespaces, variables)); + paramTypes.add(type(needsActivation, importedClasses, openedNamespaces, variables)); s = lex(); } else { paramTypes.add(new UnboundedTypeItem()); } if (s.type == SymbolType.ASSIGN) { - paramValues.add(expression(importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables)); + paramValues.add(expression(new Reference(false), importedClasses, openedNamespaces, null, isMethod, isMethod, isMethod, variables)); } else { if (!paramValues.isEmpty()) { throw new ParseException("Some of parameters do not have default values", lexer.yyline()); @@ -452,36 +455,36 @@ public class ActionScriptParser { s = lex(); GraphTargetItem retType; if (s.type == SymbolType.COLON) { - retType = type(importedClasses, openedNamespaces, variables); + retType = type(needsActivation, importedClasses, openedNamespaces, variables); } else { retType = new UnboundedTypeItem(); lexer.pushback(s); } List body = null; - List subvariables = new ArrayList<>(); + List subvariables = new ArrayList<>(); subvariables.add(new NameAVM2Item(thisType, lexer.yyline(), "this", null, true, openedNamespaces)); for (int i = 0; i < paramNames.size(); i++) { subvariables.add(new NameAVM2Item(paramTypes.get(i), lexer.yyline(), paramNames.get(i), null, true, openedNamespaces)); } subvariables.add(new NameAVM2Item(thisType, lexer.yyline(), "arguments", null, true, openedNamespaces)); int parCnt = subvariables.size(); - Reference needsActivation = new Reference<>(false); + Reference needsActivation2 = new Reference<>(false); if (withBody) { - expectedType(SymbolType.CURLY_OPEN); - body = commands(needsActivation, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, isMethod, 0, subvariables); + expectedType(SymbolType.CURLY_OPEN); + body = commands(needsActivation2, importedClasses, openedNamespaces, new Stack(), new HashMap(), new HashMap(), true, isMethod, 0, subvariables); expectedType(SymbolType.CURLY_CLOSE); } for (int i = 0; i < parCnt; i++) { subvariables.remove(0); } - return new FunctionAVM2Item(needsActivation.getVal(), namespace, hasRest, line, functionName, paramTypes, paramNames, paramValues, body, subvariables, retType); + return new FunctionAVM2Item(needsActivation2.getVal(), namespace, hasRest, line, functionName, paramTypes, paramNames, paramValues, body, subvariables, retType); } - private GraphTargetItem traits(List importedClasses, int privateNs, int protectedNs, int publicNs, int packageInternalNs, int protectedStaticNs, List openedNamespaces, String packageName, String classNameStr, boolean isInterface, List traits) throws ParseException, IOException { + private GraphTargetItem traits(List importedClasses, int privateNs, int protectedNs, int publicNs, int packageInternalNs, int protectedStaticNs, List openedNamespaces, String packageName, String classNameStr, boolean isInterface, List traits) throws ParseException, IOException, CompilationException { ParsedSymbol s; GraphTargetItem constr = null; - List variables = new ArrayList<>(); + List variables = new ArrayList<>(); TypeItem thisType = new TypeItem("".equals(packageName) ? classNameStr : packageName + "." + classNameStr); looptrait: while (true) { @@ -558,20 +561,20 @@ public class ActionScriptParser { throw new ParseException("Override flag not allowed for classes", lexer.yyline()); } - //GraphTargetItem classTypeStr = type(importedClasses, openedNamespaces, variables); + //GraphTargetItem classTypeStr = type(needsActivation, importedClasses, openedNamespaces, variables); s = lex(); expected(s, lexer.yyline(), SymbolType.IDENTIFIER); String classTypeStr = s.value.toString(); GraphTargetItem extendsTypeStr = null; s = lex(); if (s.type == SymbolType.EXTENDS) { - extendsTypeStr = type(importedClasses, openedNamespaces, variables); + extendsTypeStr = type(new Reference(false), importedClasses, openedNamespaces, variables); s = lex(); } List implementsTypeStrs = new ArrayList<>(); if (s.type == SymbolType.IMPLEMENTS) { do { - GraphTargetItem implementsTypeStr = type(importedClasses, openedNamespaces, variables); + GraphTargetItem implementsTypeStr = type(new Reference(false), importedClasses, openedNamespaces, variables); implementsTypeStrs.add(implementsTypeStr); s = lex(); } while (s.type == SymbolType.COMMA); @@ -593,7 +596,7 @@ public class ActionScriptParser { if (isDynamic) { throw new ParseException("Dynamic flag not allowed for interfaces", lexer.yyline()); } - //GraphTargetItem interfaceTypeStr = type(importedClasses, openedNamespaces, variables); + //GraphTargetItem interfaceTypeStr = type(needsActivation, importedClasses, openedNamespaces, variables); s = lex(); expected(s, lexer.yyline(), SymbolType.IDENTIFIER); String intTypeStr = s.value.toString(); @@ -602,7 +605,7 @@ public class ActionScriptParser { if (s.type == SymbolType.EXTENDS) { do { - GraphTargetItem intExtendsTypeStr = type(importedClasses, openedNamespaces, variables); + GraphTargetItem intExtendsTypeStr = type(new Reference(false), importedClasses, openedNamespaces, variables); intExtendsTypeStrs.add(intExtendsTypeStr); s = lex(); } while (s.type == SymbolType.COMMA); @@ -647,29 +650,29 @@ public class ActionScriptParser { if (isFinal) { throw new ParseException("Final flag not allowed for constructor", lexer.yyline()); } - constr = (method(importedClasses, false, false, thisType, openedNamespaces, false, namespace, !isInterface, "", true, variables)); + constr = (method(new Reference(false), importedClasses, false, false, thisType, openedNamespaces, false, namespace, !isInterface, "", true, variables)); } else { if (isStatic) { GraphTargetItem t; - MethodAVM2Item ft = method(importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, !isInterface, fname, true, variables); + MethodAVM2Item ft = method(new Reference(false), importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, !isInterface, fname, true, variables); traits.add(ft); if (isGetter || isSetter) { throw new ParseException("Getter or Setter cannot be static", lexer.yyline()); } } else { - MethodAVM2Item ft = method(importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, !isInterface, fname, true, variables); + MethodAVM2Item ft = method(new Reference(false), importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, !isInterface, fname, true, variables); GraphTargetItem t; if (isGetter) { if (!ft.paramTypes.isEmpty()) { throw new ParseException("Getter can't have any parameters", lexer.yyline()); } - GetterAVM2Item g = new GetterAVM2Item(ft.needsActivation,ft.hasRest, ft.line, ft.isOverride(), ft.isFinal(), isStatic, ft.namespace, ft.functionName, ft.paramTypes, ft.paramNames, ft.paramValues, ft.body, ft.subvariables, ft.retType); + GetterAVM2Item g = new GetterAVM2Item(ft.needsActivation, ft.hasRest, ft.line, ft.isOverride(), ft.isFinal(), isStatic, ft.namespace, ft.functionName, ft.paramTypes, ft.paramNames, ft.paramValues, ft.body, ft.subvariables, ft.retType); t = g; } else if (isSetter) { if (ft.paramTypes.size() != 1) { throw new ParseException("Getter must have exactly one parameter", lexer.yyline()); } - SetterAVM2Item st = new SetterAVM2Item(ft.needsActivation,ft.hasRest, ft.line, ft.isOverride(), ft.isFinal(), isStatic, ft.namespace, ft.functionName, ft.paramTypes, ft.paramNames, ft.paramValues, ft.body, ft.subvariables, ft.retType); + SetterAVM2Item st = new SetterAVM2Item(ft.needsActivation, ft.hasRest, ft.line, ft.isOverride(), ft.isFinal(), isStatic, ft.namespace, ft.functionName, ft.paramTypes, ft.paramNames, ft.paramValues, ft.body, ft.subvariables, ft.retType); t = st; } else { t = ft; @@ -721,14 +724,14 @@ public class ActionScriptParser { s = lex(); GraphTargetItem type = null; if (s.type == SymbolType.COLON) { - type = type(importedClasses, openedNamespaces, variables); + type = type(new Reference(false), importedClasses, openedNamespaces, variables); s = lex(); } GraphTargetItem value = null; if (s.type == SymbolType.ASSIGN) { - value = expression(importedClasses, openedNamespaces, new HashMap(), false, false, true, variables); + value = expression(new Reference(false), importedClasses, openedNamespaces, new HashMap(), false, false, true, variables); s = lex(); } GraphTargetItem tar; @@ -751,7 +754,7 @@ public class ActionScriptParser { return constr; } - private GraphTargetItem classTraits(int packageInternalNs, List importedClasses, int privateNs, boolean isDynamic, boolean isFinal, List openedNamespaces, String packageName, int namespace, boolean isInterface, String nameStr, GraphTargetItem extendsStr, List implementsStr, List variables) throws IOException, ParseException { + private GraphTargetItem classTraits(int packageInternalNs, List importedClasses, int privateNs, boolean isDynamic, boolean isFinal, List openedNamespaces, String packageName, int namespace, boolean isInterface, String nameStr, GraphTargetItem extendsStr, List implementsStr, List variables) throws IOException, ParseException, CompilationException { GraphTargetItem ret = null; @@ -774,7 +777,7 @@ public class ActionScriptParser { List indices = new ArrayList<>(); List names = new ArrayList<>(); List namespaces = new ArrayList<>(); - AVM2SourceGenerator.parentNamesAddNames(abc, otherABCs, ((TypeItem) extendsStr).resolveClass(abc), indices, names, namespaces); + AVM2SourceGenerator.parentNamesAddNames(abc, otherABCs, ((TypeItem) ((UnresolvedAVM2Item) extendsStr).resolve(new ArrayList(), new ArrayList(), abc, otherABCs, new ArrayList(), new ArrayList())).resolveClass(abc), indices, names, namespaces); for (int i = 0; i < names.size(); i++) { if (namespaces.get(i).isEmpty()) { continue; @@ -791,12 +794,12 @@ public class ActionScriptParser { } } - private GraphTargetItem expressionCommands(ParsedSymbol s, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, ParseException { + private GraphTargetItem expressionCommands(ParsedSymbol s, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, List variables) throws IOException, ParseException { GraphTargetItem ret = null; switch (s.type) { /*case INT: expectedType(SymbolType.PARENT_OPEN); - ret = new ToIntegerAVM2Item(null, expression(importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); + ret = new ToIntegerAVM2Item(null, expression(needsActivation, importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); break; case NUMBER_OP: @@ -807,7 +810,7 @@ public class ActionScriptParser { ret = memberOrCall(vi, registerVars, inFunction, inMethod, variables); } else { expected(s, lexer.yyline(), SymbolType.PARENT_OPEN); - ret = new ToNumberAVM2Item(null, expression(importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); + ret = new ToNumberAVM2Item(null, expression(needsActivation, importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); } break; @@ -821,7 +824,7 @@ public class ActionScriptParser { ret = memberOrCall(vi2, registerVars, inFunction, inMethod, variables); } else { expected(s, lexer.yyline(), SymbolType.PARENT_OPEN); - ret = new ToStringAVM2Item(null, expression(importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); + ret = new ToStringAVM2Item(null, expression(needsActivation, importedClasses, openedNamespaces,openedNamespacesKinds,registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); ret = memberOrCall(ret, registerVars, inFunction, inMethod, variables); } @@ -832,7 +835,7 @@ public class ActionScriptParser { //return ret; } - private GraphTargetItem command(Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List variables) throws IOException, ParseException { + private GraphTargetItem command(Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forinlevel, boolean mustBeCommand, List variables) throws IOException, ParseException { LexBufferer buf = new LexBufferer(); lexer.addListener(buf); GraphTargetItem ret = null; @@ -858,23 +861,23 @@ public class ActionScriptParser { switch (s.type) { case USE: expectedType(SymbolType.NAMESPACE); - GraphTargetItem ns = type(importedClasses, openedNamespaces, variables); + GraphTargetItem ns = type(needsActivation, importedClasses, openedNamespaces, variables); openedNamespaces.add(abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE /*FIXME?*/, abc.constants.getStringId(ns.toString(), true)), 0, true)); break; case WITH: expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem wvar = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//(name(false, openedNamespaces, registerVars, inFunction, inMethod, variables)); + GraphTargetItem wvar = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//(name(false, openedNamespaces, registerVars, inFunction, inMethod, variables)); if (!isNameOrProp(wvar)) { throw new ParseException("Not a property or name", lexer.yyline()); } expectedType(SymbolType.PARENT_CLOSE); expectedType(SymbolType.CURLY_OPEN); - List wcmd = commands(needsActivation,importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); + List wcmd = commands(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables); expectedType(SymbolType.CURLY_CLOSE); ret = new WithAVM2Item(null, wvar, wcmd); break; /*case DELETE: - GraphTargetItem varDel = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varDel = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); if(!isNameOrProp(varDel)){ throw new ParseException("Not a property or name", lexer.yyline()); } @@ -891,7 +894,8 @@ public class ActionScriptParser { case FUNCTION: s = lexer.lex(); expected(s, lexer.yyline(), SymbolType.IDENTIFIER); - ret = (function(importedClasses, 0/*?*/, TypeItem.UNBOUNDED, openedNamespaces, true, s.value.toString(), false, variables)); + needsActivation.setVal(true); + ret = (function(needsActivation, importedClasses, 0/*?*/, TypeItem.UNBOUNDED, openedNamespaces, true, s.value.toString(), false, variables)); break; case VAR: s = lex(); @@ -900,14 +904,14 @@ public class ActionScriptParser { s = lex(); GraphTargetItem type; if (s.type == SymbolType.COLON) { - type = type(importedClasses, openedNamespaces, variables); + type = type(needsActivation, importedClasses, openedNamespaces, variables); s = lex(); } else { type = new UnboundedTypeItem(); } if (s.type == SymbolType.ASSIGN) { - GraphTargetItem varval = (expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + GraphTargetItem varval = (expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); ret = new NameAVM2Item(type, lexer.yyline(), varIdentifier, varval, true, openedNamespaces); variables.add((NameAVM2Item) ret); } else { @@ -922,7 +926,7 @@ public class ActionScriptParser { break; /*case INCREMENT: //preincrement case DECREMENT: //predecrement - GraphTargetItem varincdec = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varincdec = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); if(!isNameOrProp(varincdec)){ throw new ParseException("Not a property or name", lexer.yyline()); } @@ -935,7 +939,7 @@ public class ActionScriptParser { case SUPER: //constructor call ParsedSymbol ss2 = lex(); if (ss2.type == SymbolType.PARENT_OPEN) { - List args = call(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); + List args = call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables); ret = new ConstructSuperAVM2Item(null, new LocalRegAVM2Item(null, 0, null), args); } else {//no costructor call, but it could be calling parent methods... => handle in expression lexer.pushback(ss2); @@ -944,7 +948,7 @@ public class ActionScriptParser { break; case IF: expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem ifExpr = (expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + GraphTargetItem ifExpr = (expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); GraphTargetItem onTrue = command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables); List onTrueList = new ArrayList<>(); @@ -988,34 +992,34 @@ public class ActionScriptParser { expectedType(SymbolType.PARENT_CLOSE); ret = new DoWhileItem(null, dloop, doBody, doExpr); break; - case FOR: + case FOR: s = lex(); boolean forin = false; boolean each = false; - GraphTargetItem collection = null; + GraphTargetItem collection = null; if (s.type == SymbolType.EACH) { each = true; forin = true; s = lex(); } - expected(s, lexer.yyline(), SymbolType.PARENT_OPEN); - GraphTargetItem firstCommand=command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, false, variables); - if(firstCommand instanceof NameAVM2Item){ - NameAVM2Item nai=(NameAVM2Item)firstCommand; - if(nai.isDefinition() && nai.getAssignedValue() == null){ - firstCommand = expressionRemainder(openedNamespaces, firstCommand, registerVars, inFunction, inMethod, true, variables, importedClasses); + expected(s, lexer.yyline(), SymbolType.PARENT_OPEN); + GraphTargetItem firstCommand = command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, false, variables); + if (firstCommand instanceof NameAVM2Item) { + NameAVM2Item nai = (NameAVM2Item) firstCommand; + if (nai.isDefinition() && nai.getAssignedValue() == null) { + firstCommand = expressionRemainder(needsActivation, openedNamespaces, firstCommand, registerVars, inFunction, inMethod, true, variables, importedClasses); } } InAVM2Item inexpr = null; - if(firstCommand instanceof InAVM2Item){ + if (firstCommand instanceof InAVM2Item) { forin = true; - inexpr = (InAVM2Item)firstCommand; - }else{ - if(forin){ + inexpr = (InAVM2Item) firstCommand; + } else { + if (forin) { throw new ParseException("In expression required", lexer.yyline()); } } - + Loop floop = new Loop(uniqId(), null, null); loops.push(floop); if (loopLabel != null) { @@ -1029,14 +1033,14 @@ public class ActionScriptParser { if (firstCommand != null) { //can be empty command forFirstCommands.add(firstCommand); } - forExpr = (expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + forExpr = (expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.SEMICOLON); forFinalCommands.add(command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); } expectedType(SymbolType.PARENT_CLOSE); List forBody = new ArrayList<>(); forBody.add(command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forin ? forinlevel + 1 : forinlevel, true, variables)); - if (forin) { + if (forin) { if (each) { ret = new ForEachInAVM2Item(null, floop, inexpr, forBody); } else { @@ -1054,7 +1058,7 @@ public class ActionScriptParser { loopLabels.put(sloop, loopLabel); } expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem switchExpr = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem switchExpr = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.PARENT_CLOSE); expectedType(SymbolType.CURLY_OPEN); s = lex(); @@ -1075,7 +1079,7 @@ public class ActionScriptParser { while (s.type == SymbolType.CASE) { List caseExprs = new ArrayList<>(); while (s.type == SymbolType.CASE) { - GraphTargetItem curCaseExpr = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem curCaseExpr = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); caseExprs.add(curCaseExpr); expectedType(SymbolType.COLON); s = lex(); @@ -1156,7 +1160,7 @@ public class ActionScriptParser { ret = new ContinueItem(null, cloopId); break; case RETURN: - GraphTargetItem retexpr = expression(importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem retexpr = expression(needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables); if (retexpr == null) { ret = new ReturnVoidAVM2Item(null); } else { @@ -1179,28 +1183,38 @@ public class ActionScriptParser { String enamestr = s.value.toString(); expectedType(SymbolType.COLON); - GraphTargetItem etype = type(importedClasses, openedNamespaces, variables); + GraphTargetItem etype = type(needsActivation, importedClasses, openedNamespaces, variables); NameAVM2Item e = new NameAVM2Item(etype, lexer.yyline(), enamestr, new ExceptionAVM2Item(null)/*?*/, true/*?*/, openedNamespaces); variables.add(e); catchExceptions.add(e); e.setSlotNumber(1); e.setSlotScope(2); //? - expectedType(SymbolType.PARENT_CLOSE); + expectedType(SymbolType.PARENT_CLOSE); List cc = new ArrayList<>(); cc.add(command(needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables)); catchCommands.add(cc); s = lex(); found = true; } - for(int i=varCnt;i(), new ArrayList(), abc, otherABCs, new ArrayList(), variables); + } catch (CompilationException ex) { + //ignore + } + ui.setSlotNumber(e.getSlotNumber()); + ui.setSlotScope(e.getSlotScope()); + } } } } - + List finallyCommands = null; if (s.type == SymbolType.FINALLY) { finallyCommands = new ArrayList<>(); @@ -1217,7 +1231,7 @@ public class ActionScriptParser { ret = tai; break; case THROW: - ret = new ThrowAVM2Item(null, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new ThrowAVM2Item(null, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); break; default: GraphTargetItem valcmd = expressionCommands(s, registerVars, inFunction, inMethod, forinlevel, variables); @@ -1229,7 +1243,7 @@ public class ActionScriptParser { return null; } lexer.pushback(s); - ret = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + ret = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); if (debugMode) { System.out.println("/command"); } @@ -1240,7 +1254,7 @@ public class ActionScriptParser { lexer.removeListener(buf); if (ret == null) { //can be popped expression buf.pushAllBack(lexer); - ret = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + ret = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); } s = lex(); if ((s != null) && (s.type != SymbolType.SEMICOLON)) { @@ -1251,8 +1265,8 @@ public class ActionScriptParser { } - private GraphTargetItem expression(List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, ParseException { - return expression(importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables); + private GraphTargetItem expression(Reference needsActivation, List importedClasses, List openedNamespaces, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, ParseException { + return expression(needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, allowRemainder, variables); } private GraphTargetItem fixPrecedence(GraphTargetItem expr) { @@ -1273,14 +1287,14 @@ public class ActionScriptParser { return ret; } - private GraphTargetItem expressionRemainder(List openedNamespaces, GraphTargetItem expr, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables, List importedClasses) throws IOException, ParseException { + private GraphTargetItem expressionRemainder(Reference needsActivation, List openedNamespaces, GraphTargetItem expr, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables, List importedClasses) throws IOException, ParseException { GraphTargetItem ret = null; ParsedSymbol s = lex(); switch (s.type) { case NAMESPACE_OP: s = lex(); if (s.type == SymbolType.BRACKET_OPEN) { - GraphTargetItem index = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem index = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); NameAVM2Item name = new NameAVM2Item(new UnboundedTypeItem(), lexer.yyline(), null, null, false, openedNamespaces); name.setIndex(index); name.setNs(expr); @@ -1288,10 +1302,11 @@ public class ActionScriptParser { expectedType(SymbolType.BRACKET_CLOSE); } else { lexer.pushback(s); - GraphTargetItem name = name(false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); - if (name instanceof NameAVM2Item) { - ((NameAVM2Item) name).setNs(expr); - ((NameAVM2Item) name).unresolved = false; + GraphTargetItem name = name(needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); + if (name instanceof UnresolvedAVM2Item) { + ((UnresolvedAVM2Item) name).setNs(expr); + //((UnresolvedAVM2Item) name).unresolved = false; + //TODO } else { throw new ParseException("Not a property name", lexer.yyline()); } @@ -1299,82 +1314,82 @@ public class ActionScriptParser { } break; case IN: - ret = new InAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new InAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); break; case TERNAR: - GraphTargetItem terOnTrue = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem terOnTrue = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); expectedType(SymbolType.COLON); - GraphTargetItem terOnFalse = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem terOnFalse = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); ret = new TernarOpItem(null, expr, terOnTrue, terOnFalse); break; case SHIFT_LEFT: - ret = new LShiftAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LShiftAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case SHIFT_RIGHT: - ret = new RShiftAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new RShiftAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case USHIFT_RIGHT: - ret = new URShiftAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new URShiftAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case BITAND: - ret = new BitAndAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitAndAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case BITOR: - ret = new BitOrAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitOrAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case DIVIDE: - ret = new DivideAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new DivideAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MODULO: - ret = new ModuloAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new ModuloAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case EQUALS: - ret = new EqAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new EqAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case STRICT_EQUALS: - ret = new StrictEqAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new StrictEqAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case NOT_EQUAL: - ret = new NeqAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new NeqAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case STRICT_NOT_EQUAL: - ret = new StrictNeqAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new StrictNeqAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case LOWER_THAN: - ret = new LtAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LtAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case LOWER_EQUAL: - ret = new LeAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new LeAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case GREATER_THAN: - ret = new GtAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new GtAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case GREATER_EQUAL: - ret = new GeAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new GeAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case AND: - ret = new AndItem(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new AndItem(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case OR: - ret = new OrItem(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new OrItem(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MINUS: - ret = new SubtractAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new SubtractAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case MULTIPLY: - ret = new MultiplyAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new MultiplyAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case PLUS: - ret = new AddAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new AddAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case XOR: - ret = new BitXorAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new BitXorAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case AS: //TODO break; case INSTANCEOF: - ret = new InstanceOfAVM2Item(null, expr, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); + ret = new InstanceOfAVM2Item(null, expr, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false, variables)); break; case IS: @@ -1392,7 +1407,7 @@ public class ActionScriptParser { case ASSIGN_SHIFT_RIGHT: case ASSIGN_USHIFT_RIGHT: case ASSIGN_XOR: - GraphTargetItem assigned = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem assigned = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); switch (s.type) { case ASSIGN: //assigned = assigned; @@ -1435,13 +1450,13 @@ public class ActionScriptParser { if (!(expr instanceof AssignableAVM2Item)) { throw new ParseException("Invalid assignment", lexer.yyline()); } - AssignableAVM2Item as = ((AssignableAVM2Item)expr).copy(); - if(as instanceof NameAVM2Item){ - variables.add((NameAVM2Item)as); + AssignableAVM2Item as = ((AssignableAVM2Item) expr).copy(); + if ((as instanceof UnresolvedAVM2Item) || (as instanceof NameAVM2Item)) { + variables.add(as); } as.setAssignedValue(assigned); if (expr instanceof NameAVM2Item) { - ((NameAVM2Item) expr).setDefinition(false); + ((NameAVM2Item) expr).setDefinition(false); } ret = as; break; @@ -1461,14 +1476,14 @@ public class ActionScriptParser { case BRACKET_OPEN: //member case PARENT_OPEN: //function call lexer.pushback(s); - ret = memberOrCall(importedClasses, openedNamespaces, expr, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(needsActivation, importedClasses, openedNamespaces, expr, registerVars, inFunction, inMethod, variables); break; default: lexer.pushback(s); if (expr instanceof ParenthesisItem) { if (isType(((ParenthesisItem) expr).value)) { - GraphTargetItem expr2 = expression(importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem expr2 = expression(needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, true, variables); if (expr2 != null) { ret = new CoerceAVM2Item(null, ((ParenthesisItem) expr).value, expr2); } @@ -1503,7 +1518,7 @@ public class ActionScriptParser { return false; } - private int brackets(List importedClasses, List openedNamespaces, List ret, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { + private int brackets(Reference needsActivation, List importedClasses, List openedNamespaces, List ret, HashMap registerVars, boolean inFunction, boolean inMethod, List variables) throws IOException, ParseException { ParsedSymbol s = lex(); int arrCnt = 0; if (s.type == SymbolType.BRACKET_OPEN) { @@ -1514,7 +1529,7 @@ public class ActionScriptParser { lexer.pushback(s); } arrCnt++; - ret.add(expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret.add(expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); s = lex(); if (!s.isType(SymbolType.COMMA, SymbolType.BRACKET_CLOSE)) { expected(s, lexer.yyline(), SymbolType.COMMA, SymbolType.BRACKET_CLOSE); @@ -1527,7 +1542,7 @@ public class ActionScriptParser { return arrCnt; } - private GraphTargetItem commaExpression(Reference needsActivation,List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forInLevel, List variables) throws IOException, ParseException { + private GraphTargetItem commaExpression(Reference needsActivation, List importedClasses, List openedNamespaces, Stack loops, Map loopLabels, HashMap registerVars, boolean inFunction, boolean inMethod, int forInLevel, List variables) throws IOException, ParseException { GraphTargetItem cmd = null; List expr = new ArrayList<>(); ParsedSymbol s; @@ -1540,7 +1555,7 @@ public class ActionScriptParser { } while (s.type == SymbolType.COMMA && cmd != null); lexer.pushback(s); if (cmd == null) { - expr.add(expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + expr.add(expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); } else { if (!cmd.hasReturnValue()) { throw new ParseException("Expression expected", lexer.yyline()); @@ -1549,7 +1564,7 @@ public class ActionScriptParser { return new CommaExpressionItem(null, expr); } - private GraphTargetItem expression(List importedClasses, List openedNamespaces, boolean allowEmpty, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, ParseException { + private GraphTargetItem expression(Reference needsActivation, List importedClasses, List openedNamespaces, boolean allowEmpty, HashMap registerVars, boolean inFunction, boolean inMethod, boolean allowRemainder, List variables) throws IOException, ParseException { if (debugMode) { System.out.println("expression:"); } @@ -1572,7 +1587,7 @@ public class ActionScriptParser { existsRemainder = true; } else { lexer.pushback(s); - GraphTargetItem num = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); + GraphTargetItem num = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables); if (num instanceof IntegerValueAVM2Item) { ((IntegerValueAVM2Item) num).value = -((IntegerValueAVM2Item) num).value; ret = num; @@ -1591,7 +1606,7 @@ public class ActionScriptParser { break; case TYPEOF: expectedType(SymbolType.PARENT_OPEN); - ret = new TypeOfAVM2Item(null, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new TypeOfAVM2Item(null, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); existsRemainder = true; break; @@ -1622,9 +1637,9 @@ public class ActionScriptParser { expected(s, lexer.yyline(), SymbolType.IDENTIFIER, SymbolType.STRING); GraphTargetItem n = new StringAVM2Item(null, s.value.toString()); -//expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); +//expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); expectedType(SymbolType.COLON); - GraphTargetItem v = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); + GraphTargetItem v = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, allowRemainder, variables); NameValuePair nv = new NameValuePair(n, v); nvs.add(nv); @@ -1638,7 +1653,7 @@ public class ActionScriptParser { case BRACKET_OPEN: //Array literal or just brackets lexer.pushback(s); List inBrackets = new ArrayList<>(); - int arrCnt = brackets(importedClasses, openedNamespaces, inBrackets, registerVars, inFunction, inMethod, variables); + int arrCnt = brackets(needsActivation, importedClasses, openedNamespaces, inBrackets, registerVars, inFunction, inMethod, variables); ret = new NewArrayAVM2Item(null, inBrackets); break; case FUNCTION: @@ -1649,8 +1664,8 @@ public class ActionScriptParser { } else { lexer.pushback(s); } - ret = function(importedClasses, 0/*?*/, TypeItem.UNBOUNDED, openedNamespaces, true, fname, false, variables); - //TODO + needsActivation.setVal(true); + ret = function(needsActivation, importedClasses, 0/*?*/, TypeItem.UNBOUNDED, openedNamespaces, true, fname, false, variables); break; case NAN: ret = new NanAVM2Item(null); @@ -1669,7 +1684,7 @@ public class ActionScriptParser { existsRemainder = true; break; case DELETE: - GraphTargetItem varDel = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varDel = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); if (!isNameOrProp(varDel)) { throw new ParseException("Not a property or name", lexer.yyline()); } @@ -1682,7 +1697,7 @@ public class ActionScriptParser { break; case INCREMENT: case DECREMENT: //preincrement - GraphTargetItem varincdec = expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); + GraphTargetItem varincdec = expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables);//name(false, openedNamespaces, registerVars, inFunction, inMethod, variables); if (!isNameOrProp(varincdec)) { throw new ParseException("Not a property or name", lexer.yyline()); } @@ -1695,27 +1710,27 @@ public class ActionScriptParser { existsRemainder = true; break; case NOT: - ret = new NotItem(null, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new NotItem(null, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); existsRemainder = true; break; case PARENT_OPEN: - ret = new ParenthesisItem(null, expression(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); + ret = new ParenthesisItem(null, expression(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables)); expectedType(SymbolType.PARENT_CLOSE); - ret = memberOrCall(importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); + ret = memberOrCall(needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables); existsRemainder = true; break; case NEW: - GraphTargetItem newvar = name(true, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); + GraphTargetItem newvar = name(needsActivation, true, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); expectedType(SymbolType.PARENT_OPEN); - ret = new ConstructSomethingAVM2Item(newvar, call(importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); + ret = new ConstructSomethingAVM2Item(newvar, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables)); existsRemainder = true; break; case IDENTIFIER: case THIS: case SUPER: lexer.pushback(s); - GraphTargetItem var = name(false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); - var = memberOrCall(importedClasses, openedNamespaces, var, registerVars, inFunction, inMethod, variables); + GraphTargetItem var = name(needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses); + var = memberOrCall(needsActivation, importedClasses, openedNamespaces, var, registerVars, inFunction, inMethod, variables); ret = var; existsRemainder = true; break; @@ -1731,7 +1746,7 @@ public class ActionScriptParser { if (allowRemainder && existsRemainder) { GraphTargetItem rem = ret; do { - rem = expressionRemainder(openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); + rem = expressionRemainder(needsActivation, openedNamespaces, rem, registerVars, inFunction, inMethod, assocRight, variables, importedClasses); if (rem != null) { ret = rem; } @@ -1746,7 +1761,7 @@ public class ActionScriptParser { private ActionScriptLexer lexer = null; private List constantPool; - private PackageAVM2Item parsePackage(String fileName) throws IOException, ParseException { + private PackageAVM2Item parsePackage(String fileName) throws IOException, ParseException, CompilationException { ParsedSymbol s = lex(); expected(s, lexer.yyline(), SymbolType.PACKAGE); String name = ""; @@ -1833,7 +1848,7 @@ public class ActionScriptParser { return new PackageAVM2Item(name, items); } - public PackageAVM2Item packageFromString(String str, String fileName) throws ParseException, IOException { + public PackageAVM2Item packageFromString(String str, String fileName) throws ParseException, IOException, CompilationException { this.constantPool = constantPool; lexer = new ActionScriptLexer(new StringReader(str)); @@ -1844,7 +1859,7 @@ public class ActionScriptParser { return ret; } - public void addScriptFromTree(PackageAVM2Item pkg, boolean documentClass) throws ParseException { + public void addScriptFromTree(PackageAVM2Item pkg, boolean documentClass) throws ParseException, CompilationException { AVM2SourceGenerator gen = new AVM2SourceGenerator(abc, otherABCs); List ret = new ArrayList<>(); SourceGeneratorLocalData localData = new SourceGeneratorLocalData( @@ -1858,7 +1873,7 @@ public class ActionScriptParser { abc.script_info.add(gen.generateScriptInfo(pkg, localData, pkg.items, documentClass)); } - public void addScript(String s, boolean documentClass, String fileName) throws ParseException, IOException { + public void addScript(String s, boolean documentClass, String fileName) throws ParseException, IOException, CompilationException { PackageAVM2Item pkg = packageFromString(s, fileName); addScriptFromTree(pkg, documentClass); } @@ -1868,7 +1883,7 @@ public class ActionScriptParser { this.otherABCs = otherABCs; } - public static void compile(String src, String dst) { + public static void compile(String src, String dst) { System.err.println("WARNING: AS3 compiler is not finished yet. This is only used for debuggging!"); try { SWC swc = new SWC(new FileInputStream(Configuration.getPlayerSWC())); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java index 8b2f6d3eb..a1d8781c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java @@ -34,6 +34,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.GetSlotIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.SetSlotIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.DupIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -53,13 +54,13 @@ public abstract class AssignableAVM2Item extends AVM2Item { } public abstract AssignableAVM2Item copy(); - + public AssignableAVM2Item(GraphTargetItem storeValue) { super(null, PRECEDENCE_PRIMARY); this.assignedValue = storeValue; } - public abstract List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn); + public abstract List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) throws CompilationException; public GraphTargetItem getAssignedValue() { return assignedValue; @@ -134,7 +135,7 @@ public abstract class AssignableAVM2Item extends AVM2Item { public static AVM2Instruction generateGetLoc(int regNumber) { switch (regNumber) { case -1: - return null; + return null; case 0: return ins(new GetLocal0Ins()); case 1: @@ -147,25 +148,25 @@ public abstract class AssignableAVM2Item extends AVM2Item { return ins(new GetLocalIns(), regNumber); } } - - public static List generateGetSlot(int slotScope,int slotNumber){ - if(slotNumber==-1){ + + public static List generateGetSlot(int slotScope, int slotNumber) { + if (slotNumber == -1) { return null; } List ret = new ArrayList<>(); - ret.add(ins(new GetScopeObjectIns(),slotScope)); - ret.add(ins(new GetSlotIns(),slotNumber)); + ret.add(ins(new GetScopeObjectIns(), slotScope)); + ret.add(ins(new GetSlotIns(), slotNumber)); return ret; } - public static List generateSetSlot(SourceGeneratorLocalData localData,SourceGenerator generator, GraphTargetItem val,int slotScope,int slotNumber){ - if(slotNumber==-1){ + public static List generateSetSlot(SourceGeneratorLocalData localData, SourceGenerator generator, GraphTargetItem val, int slotScope, int slotNumber) throws CompilationException { + if (slotNumber == -1) { return null; } List ret = new ArrayList<>(); - ret.add(ins(new GetScopeObjectIns(),slotScope)); + ret.add(ins(new GetScopeObjectIns(), slotScope)); ret.addAll(val.toSource(localData, generator)); - ret.add(ins(new SetSlotIns(),slotNumber)); + ret.add(ins(new SetSlotIns(), slotNumber)); return ret; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java index 47951c822..1ad2ebbbe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java @@ -23,7 +23,9 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.executing.CallPropVoidIn import com.jpexs.decompiler.flash.abc.avm2.instructions.executing.CallPropertyIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.FindPropertyStrictIns; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; +import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -54,11 +56,14 @@ public class CallAVM2Item extends AVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2SourceGenerator g = (AVM2SourceGenerator) generator; GraphTargetItem callable = name; + if (callable instanceof UnresolvedAVM2Item) { + callable = ((UnresolvedAVM2Item) callable).resolved; + } if (callable instanceof NameAVM2Item) { NameAVM2Item n = (NameAVM2Item) callable; List allAbcs = new ArrayList<>(); @@ -82,7 +87,7 @@ public class CallAVM2Item extends AVM2Item { nobj.setRegNumber(0); obj = nobj; } - PropertyAVM2Item p = new PropertyAVM2Item(obj, n.getVariableName(), n.getIndex(), g.abc, g.allABCs, n.openedNamespaces); + PropertyAVM2Item p = new PropertyAVM2Item(obj, n.getVariableName(), n.getIndex(), g.abc, g.allABCs, n.openedNamespaces, new ArrayList()); p.setAssignedValue(n.getAssignedValue()); callable = p; } @@ -91,24 +96,50 @@ public class CallAVM2Item extends AVM2Item { PropertyAVM2Item prop = (PropertyAVM2Item) callable; Object obj = prop.object; if (obj == null) { - obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{prop.resolveProperty()}, new byte[0]); + + List allAbcs = new ArrayList<>(); + allAbcs.add(g.abc); + allAbcs.addAll(g.allABCs); + String cname; + String pkgName = ""; + cname = localData.currentClass; + if (cname.contains(".")) { + pkgName = cname.substring(0, cname.lastIndexOf('.')); + cname = cname.substring(cname.lastIndexOf('.') + 1); + } + Reference outName = new Reference<>(""); + Reference outNs = new Reference<>(""); + Reference outPropNs = new Reference<>(""); + Reference outPropNsKind = new Reference<>(1); + Reference outPropType = new Reference<>(""); + if (AVM2SourceGenerator.searchPrototypeChain(true, allAbcs, pkgName, cname, prop.propertyName, outName, outNs, outPropNs, outPropNsKind, outPropType)) { + NameAVM2Item nobj = new NameAVM2Item(new TypeItem(localData.currentClass), 0, "this", null, false, new ArrayList()); + nobj.setRegNumber(0); + obj = nobj; + } else { + obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{prop.resolveProperty(localData)}, new byte[0]); + } } return toSourceMerge(localData, generator, obj, prop.index, arguments, - new AVM2Instruction(0, new CallPropertyIns(), new int[]{prop.resolveProperty(), arguments.size()}, new byte[0]) + new AVM2Instruction(0, new CallPropertyIns(), new int[]{prop.resolveProperty(localData), arguments.size()}, new byte[0]) ); } return new ArrayList<>(); } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { AVM2SourceGenerator g = (AVM2SourceGenerator) generator; GraphTargetItem callable = name; + if (callable instanceof UnresolvedAVM2Item) { + callable = ((UnresolvedAVM2Item) callable).resolved; + } + if (callable instanceof NameAVM2Item) { NameAVM2Item n = (NameAVM2Item) callable; - PropertyAVM2Item p = new PropertyAVM2Item(null, n.getVariableName(), n.getIndex(), g.abc, g.allABCs, n.openedNamespaces); + PropertyAVM2Item p = new PropertyAVM2Item(null, n.getVariableName(), n.getIndex(), g.abc, g.allABCs, n.openedNamespaces, new ArrayList()); p.setAssignedValue(n.getAssignedValue()); callable = p; } @@ -117,10 +148,10 @@ public class CallAVM2Item extends AVM2Item { PropertyAVM2Item prop = (PropertyAVM2Item) callable; Object obj = prop.object; if (obj == null) { - obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{prop.resolveProperty()}, new byte[0]); + obj = new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{prop.resolveProperty(localData)}, new byte[0]); } return toSourceMerge(localData, generator, obj, prop.index, arguments, - new AVM2Instruction(0, new CallPropVoidIns(), new int[]{prop.resolveProperty(), arguments.size()}, new byte[0]) + new AVM2Instruction(0, new CallPropVoidIns(), new int[]{prop.resolveProperty(localData), arguments.size()}, new byte[0]) ); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java index 4cebd125d..1ff203841 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.ConstructPropIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.other.FindPropertyStrictIns; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -43,17 +44,22 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { - if (name instanceof TypeItem) { - TypeItem prop = (TypeItem) name; - int type_index = ((AVM2SourceGenerator) generator).resolveType(name.toString()); + GraphTargetItem resname = name; + if (resname instanceof UnresolvedAVM2Item) { + resname = ((UnresolvedAVM2Item) resname).resolved; + } + + if (resname instanceof TypeItem) { + TypeItem prop = (TypeItem) resname; + int type_index = ((AVM2SourceGenerator) generator).resolveType(resname.toString()); return toSourceMerge(localData, generator, new AVM2Instruction(0, new FindPropertyStrictIns(), new int[]{type_index, arguments.size()}, new byte[0]), arguments, new AVM2Instruction(0, new ConstructPropIns(), new int[]{type_index, arguments.size()}, new byte[0]) ); } - if (name instanceof NameAVM2Item) { + if (resname instanceof NameAVM2Item) { //TODO } return new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java index c1253a58c..920a5e6a7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/FunctionAVM2Item.java @@ -16,9 +16,14 @@ */ package com.jpexs.decompiler.flash.abc.avm2.parser.script; +import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; +import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.SourceGenerator; +import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.LocalData; import java.util.List; @@ -33,7 +38,7 @@ public class FunctionAVM2Item extends AVM2Item { public int namespace; public List paramNames; public List body; - public List subvariables; + public List subvariables; public List paramTypes; public List paramValues; public GraphTargetItem retType; @@ -41,7 +46,7 @@ public class FunctionAVM2Item extends AVM2Item { public boolean hasRest; public boolean needsActivation; - public FunctionAVM2Item(boolean needsActivation, int namespace, boolean hasRest, int line, String functionName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { + public FunctionAVM2Item(boolean needsActivation, int namespace, boolean hasRest, int line, String functionName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { super(null, NOPRECEDENCE); this.needsActivation = needsActivation; this.namespace = namespace; @@ -63,7 +68,7 @@ public class FunctionAVM2Item extends AVM2Item { @Override public GraphTargetItem returnType() { - return retType; + return new TypeItem("Function"); } @Override @@ -71,4 +76,9 @@ public class FunctionAVM2Item extends AVM2Item { return true; } + @Override + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + return ((AVM2SourceGenerator) generator).generate(localData, this); + } + } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java index c7d169b12..fe9347f60 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/GetterAVM2Item.java @@ -25,8 +25,8 @@ import java.util.List; */ public class GetterAVM2Item extends MethodAVM2Item { - public GetterAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { - super(needsActivation,hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); + public GetterAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { + super(needsActivation, hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java index 69c44bf39..878d8cfa7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/MethodAVM2Item.java @@ -31,8 +31,8 @@ public class MethodAVM2Item extends FunctionAVM2Item { private boolean isFinal; private boolean override; - public MethodAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { - super(needsActivation,namespace, hasRest, line, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); + public MethodAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { + super(needsActivation, namespace, hasRest, line, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); this.isStatic = isStatic; this.override = override; this.isFinal = isFinal; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index 5446c03dd..1d565c5ae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -46,6 +46,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.UndefinedAVM2Item; import com.jpexs.decompiler.flash.abc.types.Multiname; import com.jpexs.decompiler.flash.abc.types.NamespaceSet; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -217,11 +218,11 @@ public class NameAVM2Item extends AssignableAVM2Item { return ins; } - private List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) { + private List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { if (variableName != null && regNumber == -1 && slotNumber == -1 && ns == null) { throw new RuntimeException("No register or slot set for " + variableName); } - if (definition && assignedValue == null) { + if (definition && assignedValue == null) { return new ArrayList<>(); } AVM2SourceGenerator g = (AVM2SourceGenerator) generator; @@ -309,7 +310,7 @@ public class NameAVM2Item extends AssignableAVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (redirect != null) { return redirect.toSource(localData, generator); } @@ -318,7 +319,7 @@ public class NameAVM2Item extends AssignableAVM2Item { } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (redirect != null) { return redirect.toSourceIgnoreReturnValue(localData, generator); } @@ -358,7 +359,7 @@ public class NameAVM2Item extends AssignableAVM2Item { } @Override - public List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) { + public List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) throws CompilationException { if (redirect != null) { return ((AssignableAVM2Item) redirect).toSourceChange(localData, generator, post, decrement, needsReturn); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index b5037dde5..6c5c7b109 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -32,11 +32,14 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertDIns; import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; import com.jpexs.decompiler.flash.abc.types.InstanceInfo; +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.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -58,22 +61,22 @@ public class PropertyAVM2Item extends AssignableAVM2Item { public List otherABCs; public GraphTargetItem index; private List openedNamespaces; + private List callStack; @Override public AssignableAVM2Item copy() { - PropertyAVM2Item p =new PropertyAVM2Item(object, propertyName, index, abc, otherABCs, openedNamespaces); + PropertyAVM2Item p = new PropertyAVM2Item(object, propertyName, index, abc, otherABCs, openedNamespaces, callStack); return p; } - - - public PropertyAVM2Item(GraphTargetItem object, String propertyName, GraphTargetItem index, ABC abc, List otherABCs, List openedNamespaces) { + public PropertyAVM2Item(GraphTargetItem object, String propertyName, GraphTargetItem index, ABC abc, List otherABCs, List openedNamespaces, List callStack) { this.propertyName = propertyName; this.object = object; this.otherABCs = otherABCs; this.abc = abc; this.index = index; this.openedNamespaces = openedNamespaces; + this.callStack = callStack; } @Override @@ -89,70 +92,90 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return abc.constants.getNamespaceSetId(new NamespaceSet(nssa), true); } - private void resolve(Reference objectType, Reference propertyType, Reference propertyIndex) { + private void resolve(SourceGeneratorLocalData localData, Reference objectType, Reference propertyType, Reference propertyIndex) { String objType = object == null ? null : object.returnType().toString(); String propType = ""; int propIndex = 0; if (objType == null) { - loopobjType: - for (int i = 0; i < openedNamespaces.size(); i++) { - int nsindex = openedNamespaces.get(i); - int nsKind = abc.constants.constant_namespace.get(openedNamespaces.get(i)).kind; - String nsname = abc.constants.constant_namespace.get(openedNamespaces.get(i)).getName(abc.constants); - int name_index = 0; - for (int m = 1; m < abc.constants.constant_multiname.size(); m++) { - Multiname mname = abc.constants.constant_multiname.get(m); - if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList()).equals(propertyName) && mname.namespace_index == nsindex) { - name_index = m; - break; - } - } - if (name_index > 0) { - for (int c = 0; c < abc.instance_info.size(); c++) { - for (Trait t : abc.instance_info.get(c).instance_traits.traits) { - if (t.name_index == name_index) { - objType = abc.instance_info.get(c).getName(abc.constants).getNameWithNamespace(abc.constants); - propType = AVM2SourceGenerator.getTraitReturnType(abc, t).toString(); - propIndex = t.name_index; - break loopobjType; - } - } - for (Trait t : abc.class_info.get(c).static_traits.traits) { - if (t.name_index == name_index) { - objType = abc.instance_info.get(c).getName(abc.constants).getNameWithNamespace(abc.constants); - propType = AVM2SourceGenerator.getTraitReturnType(abc, t).toString(); - propIndex = t.name_index; - break loopobjType; - } - } - } - } - if (nsKind == Namespace.KIND_PACKAGE) { - List abcs = new ArrayList<>(); - abcs.add(abc); - abcs.addAll(otherABCs); - loopabc: - for (ABC a : otherABCs) { - for (int h = 0; h < a.instance_info.size(); h++) { - InstanceInfo ii = a.instance_info.get(h); - Multiname n = a.constants.constant_multiname.get(ii.name_index); - if (n.getNamespace(a.constants).kind == Namespace.KIND_PACKAGE && n.getNamespace(a.constants).getName(a.constants).equals(nsname)) { - Reference outName = new Reference<>(""); - Reference outNs = new Reference<>(""); - Reference outPropNs = new Reference<>(""); - Reference outPropNsKind = new Reference<>(1); - Reference outPropType = new Reference<>(""); - if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList()), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropType)) { - objType = "".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal(); - propType = outPropType.getVal(); - propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, - abc.constants.getStringId(propertyName, true), - abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), 0, true), 0, 0, new ArrayList()), true - ); + for (MethodBody b : callStack) { + for (int i = 0; i < b.traits.traits.size(); i++) { + Trait t = b.traits.traits.get(i); + if (t.getName(abc).getName(abc.constants, new ArrayList()).equals(propertyName)) { + if (t instanceof TraitSlotConst) { + TraitSlotConst tsc = (TraitSlotConst) t; + objType = "Function"; + propType = tsc.type_index == 0 ? "*" : abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants); + propIndex = tsc.name_index; + if (!localData.traitUsages.containsKey(b)) { + localData.traitUsages.put(b, new ArrayList()); + } + localData.traitUsages.get(b).add(i); + } + } + } + } + if (objType == null) { + loopobjType: + for (int i = 0; i < openedNamespaces.size(); i++) { + int nsindex = openedNamespaces.get(i); + int nsKind = abc.constants.constant_namespace.get(openedNamespaces.get(i)).kind; + String nsname = abc.constants.constant_namespace.get(openedNamespaces.get(i)).getName(abc.constants); + int name_index = 0; + for (int m = 1; m < abc.constants.constant_multiname.size(); m++) { + Multiname mname = abc.constants.constant_multiname.get(m); + if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList()).equals(propertyName) && mname.namespace_index == nsindex) { + name_index = m; + break; + } + } + if (name_index > 0) { + for (int c = 0; c < abc.instance_info.size(); c++) { + for (Trait t : abc.instance_info.get(c).instance_traits.traits) { + if (t.name_index == name_index) { + objType = abc.instance_info.get(c).getName(abc.constants).getNameWithNamespace(abc.constants); + propType = AVM2SourceGenerator.getTraitReturnType(abc, t).toString(); + propIndex = t.name_index; break loopobjType; } } + for (Trait t : abc.class_info.get(c).static_traits.traits) { + if (t.name_index == name_index) { + objType = abc.instance_info.get(c).getName(abc.constants).getNameWithNamespace(abc.constants); + propType = AVM2SourceGenerator.getTraitReturnType(abc, t).toString(); + propIndex = t.name_index; + break loopobjType; + } + } + } + } + if (nsKind == Namespace.KIND_PACKAGE) { + List abcs = new ArrayList<>(); + abcs.add(abc); + abcs.addAll(otherABCs); + loopabc: + for (ABC a : otherABCs) { + for (int h = 0; h < a.instance_info.size(); h++) { + InstanceInfo ii = a.instance_info.get(h); + Multiname n = a.constants.constant_multiname.get(ii.name_index); + if (n.getNamespace(a.constants).kind == Namespace.KIND_PACKAGE && n.getNamespace(a.constants).getName(a.constants).equals(nsname)) { + Reference outName = new Reference<>(""); + Reference outNs = new Reference<>(""); + Reference outPropNs = new Reference<>(""); + Reference outPropNsKind = new Reference<>(1); + Reference outPropType = new Reference<>(""); + if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList()), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropType)) { + objType = "".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal(); + propType = outPropType.getVal(); + propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, + abc.constants.getStringId(propertyName, true), + abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), 0, true), 0, 0, new ArrayList()), true + ); + + break loopobjType; + } + } + } } } } @@ -199,11 +222,11 @@ public class PropertyAVM2Item extends AssignableAVM2Item { objectType.setVal(objType); } - public int resolveProperty() { + public int resolveProperty(SourceGeneratorLocalData localData) { Reference objType = new Reference<>(""); Reference propType = new Reference<>(""); Reference propIndex = new Reference<>(0); - resolve(objType, propType, propIndex); + resolve(localData, objType, propType, propIndex); return propIndex.getVal(); } @@ -374,17 +397,17 @@ public class PropertyAVM2Item extends AssignableAVM2Item { Reference objType = new Reference<>(""); Reference propType = new Reference<>(""); Reference propIndex = new Reference<>(0); - resolve(objType, propType, propIndex); + resolve(null, objType, propType, propIndex); return new TypeItem(propType.getVal()); } - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException { Reference objType = new Reference<>(""); Reference propType = new Reference<>(""); Reference propIndex = new Reference<>(0); - resolve(objType, propType, propIndex); + resolve(localData, objType, propType, propIndex); int propertyId = propIndex.getVal(); Object obj = resolveObject(localData, generator); @@ -415,12 +438,12 @@ public class PropertyAVM2Item extends AssignableAVM2Item { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSource(localData, generator, true); } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSource(localData, generator, false); } @@ -456,7 +479,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { Reference objType = new Reference<>(""); Reference propType = new Reference<>(""); Reference propIndex = new Reference<>(0); - resolve(objType, propType, propIndex); + resolve(localData, objType, propType, propIndex); obj = ins(new FindPropertyStrictIns(), propIndex.getVal()); } } @@ -464,12 +487,12 @@ public class PropertyAVM2Item extends AssignableAVM2Item { } @Override - public List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) { + public List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) throws CompilationException { Reference objType = new Reference<>(""); Reference propType = new Reference<>(""); Reference propIndex = new Reference<>(0); - resolve(objType, propType, propIndex); + resolve(localData, objType, propType, propIndex); int propertyId = propIndex.getVal(); Object obj = resolveObject(localData, generator); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java index c503f7328..b4ff4b571 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SetterAVM2Item.java @@ -25,8 +25,8 @@ import java.util.List; */ public class SetterAVM2Item extends MethodAVM2Item { - public SetterAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { - super(needsActivation,hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); + public SetterAVM2Item(boolean needsActivation, boolean hasRest, int line, boolean override, boolean isFinal, boolean isStatic, int namespace, String methodName, List paramTypes, List paramNames, List paramValues, List body, List subvariables, GraphTargetItem retType) { + super(needsActivation, hasRest, line, override, isFinal, isStatic, namespace, methodName, paramTypes, paramNames, paramValues, body, subvariables, retType); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java new file mode 100644 index 000000000..8b8627435 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java @@ -0,0 +1,424 @@ +/* + * Copyright (C) 2014 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.parser.script; + +import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.ABC; +import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceAIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceSIns; +import com.jpexs.decompiler.flash.abc.avm2.instructions.types.ConvertIIns; +import static com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item.ins; +import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NanAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.UndefinedAVM2Item; +import com.jpexs.decompiler.flash.abc.types.MethodBody; +import com.jpexs.decompiler.flash.abc.types.Namespace; +import com.jpexs.decompiler.flash.abc.types.NamespaceSet; +import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; +import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.SourceGenerator; +import com.jpexs.decompiler.graph.TypeItem; +import com.jpexs.decompiler.graph.model.LocalData; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class UnresolvedAVM2Item extends AssignableAVM2Item { + + private String name; + + private GraphTargetItem index; + private int nsKind = -1; + public List openedNamespaces; + public int line; + public GraphTargetItem type; + private GraphTargetItem ns = null; + public GraphTargetItem resolved; + private boolean mustBeType; + public List importedClasses; + + @Override + public AssignableAVM2Item copy() { + UnresolvedAVM2Item c = new UnresolvedAVM2Item(importedClasses, mustBeType, type, line, name, assignedValue, openedNamespaces); + c.setNs(ns); + c.nsKind = nsKind; + c.setIndex(index); + c.resolved = resolved; + return c; + } + + public void setSlotScope(int slotScope) { + if (resolved instanceof NameAVM2Item) { + ((NameAVM2Item) resolved).setSlotScope(slotScope); + } + } + + public int getSlotScope() { + if (resolved instanceof NameAVM2Item) { + return ((NameAVM2Item) resolved).getSlotScope(); + } + return -1; + } + + public void setNs(GraphTargetItem ns) { + this.ns = ns; + } + + public void setRegNumber(int regNumber) { + if (resolved instanceof NameAVM2Item) { + ((NameAVM2Item) resolved).setRegNumber(regNumber); + } + } + + public int getSlotNumber() { + if (resolved instanceof NameAVM2Item) { + return ((NameAVM2Item) resolved).getSlotNumber(); + } + return -1; + } + + public void setSlotNumber(int slotNumber) { + if (resolved instanceof NameAVM2Item) { + ((NameAVM2Item) resolved).setSlotNumber(slotNumber); + } + } + + public int getRegNumber() { + if (resolved instanceof NameAVM2Item) { + return ((NameAVM2Item) resolved).getRegNumber(); + } + return -1; + } + + public GraphTargetItem getNs() { + return ns; + } + + public void appendName(String name) { + this.name += "." + name; + } + + public void setDefinition(boolean definition) { + if (resolved instanceof NameAVM2Item) { + ((NameAVM2Item) resolved).setDefinition(definition); + } + } + + public void setIndex(GraphTargetItem index) { + this.index = index; + } + + public GraphTargetItem getIndex() { + return index; + } + + public void setNsKind(int nsKind) { + this.nsKind = nsKind; + } + + public int getNsKind() { + return nsKind; + } + + @Override + public void setAssignedValue(GraphTargetItem storeValue) { + this.assignedValue = storeValue; + } + + public String getVariableName() { + return name; + } + + public UnresolvedAVM2Item(List importedClasses, boolean mustBeType, GraphTargetItem type, int line, String name, GraphTargetItem storeValue, List openedNamespaces) { + super(storeValue); + this.name = name; + this.assignedValue = storeValue; + this.line = line; + this.type = type; + this.openedNamespaces = openedNamespaces; + this.mustBeType = mustBeType; + this.importedClasses = importedClasses; + } + + public boolean isDefinition() { + if (resolved instanceof NameAVM2Item) { + return ((NameAVM2Item) resolved).isDefinition(); + } + return false; + } + + public GraphTargetItem getStoreValue() { + return assignedValue; + } + + @Override + public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { + return writer; + } + + private int allNsSet(ABC abc) { + int nssa[] = new int[openedNamespaces.size()]; + for (int i = 0; i < openedNamespaces.size(); i++) { + nssa[i] = openedNamespaces.get(i); + } + return abc.constants.getNamespaceSetId(new NamespaceSet(nssa), true); + } + + public static GraphTargetItem getDefaultValue(String type) { + switch (type) { + case "*": + return new UndefinedAVM2Item(null); + case "int": + return new IntegerValueAVM2Item(null, 0L); + case "Number": + return new NanAVM2Item(null); + default: + return new NullAVM2Item(null); + } + } + + public static AVM2Instruction generateCoerce(SourceGenerator generator, String type) { + AVM2Instruction ins; + switch (type) { + case "int": + ins = ins(new ConvertIIns()); + break; + case "*": + ins = ins(new CoerceAIns()); + break; + case "String": + ins = ins(new CoerceSIns()); + break; + default: + int type_index = new TypeItem(type).resolveClass(((AVM2SourceGenerator) generator).abc); + ins = ins(new CoerceIns(), type_index); + break; + } + return ins; + } + + @Override + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + if (resolved == null) { + throw new RuntimeException("Unresolved"); + } + return resolved.toSource(localData, generator); + } + + @Override + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { + if (resolved == null) { + throw new RuntimeException("Unresolved"); + } + return resolved.toSourceIgnoreReturnValue(localData, generator); + } + + @Override + public boolean hasReturnValue() { + if (resolved != null) { + return resolved.hasReturnValue(); + } + return true; + } + + @Override + public boolean needsSemicolon() { + if (resolved != null) { + return resolved.needsSemicolon(); + } + return false; + } + + @Override + public String toString() { + if (resolved != null) { + return resolved.toString(); + } + return name; + } + + @Override + public GraphTargetItem returnType() { + if (index != null) { + return TypeItem.UNBOUNDED; + } + if (type == null) { + return TypeItem.UNBOUNDED; + } + return type; + } + + @Override + public List toSourceChange(SourceGeneratorLocalData localData, SourceGenerator generator, boolean post, boolean decrement, boolean needsReturn) throws CompilationException { + if (resolved == null) { + throw new RuntimeException("Unresolved"); + } + if (resolved instanceof AssignableAVM2Item) { + return ((AssignableAVM2Item) resolved).toSourceChange(localData, generator, post, decrement, needsReturn); + } + throw new RuntimeException("Cannot assign"); + } + + public GraphTargetItem resolve(List paramTypes, List paramNames, ABC abc, List otherAbcs, List callStack, List variables) throws CompilationException { + List parts = new ArrayList<>(); + if (name.contains(".")) { + String partsArr[] = name.split("\\."); + for (String p : partsArr) { + parts.add(p); + } + } else { + parts.add(name); + } + + if (ns != null) { + if (name.contains(".")) { + throw new CompilationException("Invalid property name", line); + } + resolved = new NameAVM2Item(type, line, name, assignedValue, false, openedNamespaces); + ((NameAVM2Item) resolved).setNs(ns); + ((NameAVM2Item) resolved).setIndex(index); + return resolved; + } + + //search for variable + for (AssignableAVM2Item a : variables) { + if (a instanceof NameAVM2Item) { + NameAVM2Item n = (NameAVM2Item) a; + if (n.isDefinition() && parts.get(0).equals(n.getVariableName())) { + NameAVM2Item ret = new NameAVM2Item(n.type, n.line, parts.get(0), null, false, openedNamespaces); + ret.setSlotScope(n.getSlotScope()); + ret.setSlotNumber(n.getSlotNumber()); + ret.setRegNumber(n.getRegNumber()); + resolved = ret; + for (int i = 1; i < parts.size(); i++) { + resolved = new PropertyAVM2Item(resolved, parts.get(i), null, abc, otherAbcs, openedNamespaces, new ArrayList()); + if (i == parts.size() - 1) { + ((PropertyAVM2Item) resolved).index = index; + ((PropertyAVM2Item) resolved).assignedValue = assignedValue; + } + } + if (parts.size() == 1) { + ret.setIndex(index); + ret.setAssignedValue(assignedValue); + } + ret.setNs(n.getNs()); + return ret; + } + } + } + + //Search for types in imported classes + for (String imp : importedClasses) { + String impName = imp; + String impPkg = ""; + if (impName.contains(".")) { + impPkg = impName.substring(0, impName.lastIndexOf(".")); + impName = impName.substring(impName.lastIndexOf(".") + 1); + } + if (impName.equals(parts.get(0))) { + TypeItem ret = new TypeItem(imp); + resolved = ret; + for (int i = 1; i < parts.size(); i++) { + resolved = new PropertyAVM2Item(resolved, parts.get(i), null, abc, otherAbcs, openedNamespaces, new ArrayList()); + if (i == parts.size() - 1) { + ((PropertyAVM2Item) resolved).index = index; + ((PropertyAVM2Item) resolved).assignedValue = assignedValue; + } + } + if (parts.size() == 1 && index != null) { + throw new CompilationException("Types do not have indices", line); + } + if (parts.size() == 1 && assignedValue != null) { + throw new CompilationException("Cannot assign type", line); + } + return ret; + } + } + + //Search for types in opened namespaces + List allAbcs = new ArrayList<>(); + allAbcs.add(abc); + allAbcs.addAll(otherAbcs); + for (int ni : openedNamespaces) { + Namespace ons = abc.constants.getNamespace(ni); + for (ABC a : allAbcs) { + for (int c = 0; c < a.instance_info.size(); c++) { + if ((a == abc && a.instance_info.get(c).getName(a.constants).namespace_index == ni) || (ons.kind != Namespace.KIND_PRIVATE && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants).hasName(ons.getName(abc.constants), a.constants))) { + String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, new ArrayList()); + if (cname.equals(parts.get(0))) { + TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants)); + resolved = ret; + for (int i = 1; i < parts.size(); i++) { + resolved = new PropertyAVM2Item(resolved, parts.get(i), null, abc, otherAbcs, openedNamespaces, new ArrayList()); + if (i == parts.size() - 1) { + ((PropertyAVM2Item) resolved).index = index; + ((PropertyAVM2Item) resolved).assignedValue = assignedValue; + } + } + if (parts.size() == 1 && index != null) { + throw new CompilationException("Types do not have indices", line); + } + if (parts.size() == 1 && assignedValue != null) { + throw new CompilationException("Cannot assign type", line); + } + + return ret; + } + } + } + } + } + + if (paramNames.contains(parts.get(0)) || parts.get(0).equals("arguments")) { + int ind = paramNames.indexOf(parts.get(0)); + + GraphTargetItem ret = new NameAVM2Item(ind == -1 ? TypeItem.UNBOUNDED : paramTypes.get(ind), line, name, null, false, openedNamespaces); + resolved = ret; + for (int i = 1; i < parts.size(); i++) { + resolved = new PropertyAVM2Item(resolved, parts.get(i), null, abc, otherAbcs, openedNamespaces, new ArrayList()); + if (i == parts.size() - 1) { + ((PropertyAVM2Item) resolved).index = index; + ((PropertyAVM2Item) resolved).assignedValue = assignedValue; + } + } + if (parts.size() == 1) { + ((NameAVM2Item) ret).setIndex(index); + ((NameAVM2Item) ret).setAssignedValue(assignedValue); + } + return ret; + } + + resolved = null; + GraphTargetItem ret = null; + for (int i = 0; i < parts.size(); i++) { + resolved = new PropertyAVM2Item(resolved, parts.get(i), (i == parts.size() - 1) ? index : null, abc, otherAbcs, openedNamespaces, callStack); + if (ret == null) { + ret = resolved; + } + } + return ret; + } + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt index ab421f1aa..3539689b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/todo.txt @@ -2,8 +2,9 @@ TODO List for AS3 parser/compiler: ------------------------------ - E4X (XML) - typenames (Vectors) -- inner functions (activation, slots, etc.) -- with (+ in catch clause) +- with +- try/catch scopes (with, inner functions - no this) +- inner function names - delete property - default xml namespace - custom namespace modifiers \ No newline at end of file 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 b732af1fa..d046a018e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -224,11 +224,11 @@ public class MethodBody implements Cloneable, Serializable { if (stats == null) { return false; } - if(stats.has_activation){ + if (stats.has_activation) { initScope++; } max_stack = stats.maxstack; - max_scope_depth = stats.maxscope+(stats.has_activation?1:0); + max_scope_depth = stats.maxscope + (stats.has_activation ? 1 : 0); max_regs = stats.maxlocal; init_scope_depth = initScope; abc.method_info.get(method_info).setFlagSetsdxns(stats.has_set_dxns); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java index 4d440fb68..bf3ddfadc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Multiname.java @@ -158,7 +158,7 @@ public class Multiname { String name = name_index == 0 ? null : constants.getNamespace(index).getName(constants); int sub = -1; for (int n = 1; n < constants.getNamespaceCount(); n++) { - if (constants.getNamespace(n).kind == type && constants.getNamespace(n).hasName(constants.getNamespace(index).getName(constants),constants)) { + if (constants.getNamespace(n).kind == type && constants.getNamespace(n).hasName(constants.getNamespace(index).getName(constants), constants)) { sub++; } if (n == index) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java index f70785b61..61c45c063 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/Namespace.java @@ -94,22 +94,22 @@ public class Namespace { } return kindStr; } - + public String getName(ConstantPool constants) { if (name_index == 0) { return null; } return constants.getString(name_index); } - - public boolean hasName(String name, ConstantPool constants){ - if(name == null && name_index==0){ + + public boolean hasName(String name, ConstantPool constants) { + if (name == null && name_index == 0) { return true; } - if(name == null){ + if (name == null) { return false; } - if(name_index == 0){ + if (name_index == 0) { return false; } return constants.getString(name_index).equals(name); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index 7076868b3..60c344d6f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -88,7 +88,7 @@ public abstract class Trait implements Serializable { } } - if (nsname!=null && (!nsname.contains(":")) && (!nsname.isEmpty())) { + if (nsname != null && (!nsname.contains(":")) && (!nsname.isEmpty())) { ret += " " + nsname; } if (ns != null) { 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 572d05cb3..9131d1fd3 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 @@ -96,7 +96,7 @@ public class TraitClass extends Trait implements TraitWithSlot { newimport = oldimport; newimport += "." + name; } - if (newimport!=null && newimport.isEmpty()) { + if (newimport != null && newimport.isEmpty()) { newimport = null; } if (newimport != null) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ActionItem.java index 5230bd9c3..60cfe1570 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionPop; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -64,7 +65,7 @@ public abstract class ActionItem extends GraphTargetItem implements Serializable } } - protected List toSourceCall(SourceGeneratorLocalData localData, SourceGenerator gen, List list) { + protected List toSourceCall(SourceGeneratorLocalData localData, SourceGenerator gen, List list) throws CompilationException { List ret = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { ret.addAll(0, list.get(i).toSource(localData, gen)); @@ -74,14 +75,14 @@ public abstract class ActionItem extends GraphTargetItem implements Serializable } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = toSource(localData, generator); if (hasReturnValue()) { ret.add(new ActionPop()); } return ret; } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java index 3bfeefb71..9db494f61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/AsciiToCharActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionAsciiToChar; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class AsciiToCharActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionAsciiToChar()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CallActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CallActionItem.java index 4b9230176..4d465638a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CallActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CallActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionCall; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class CallActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionCall()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java index 09564a017..95c568925 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionCallFunction; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -116,7 +117,7 @@ public class CallFunctionActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, toSourceCall(localData, generator, arguments), functionName, new ActionCallFunction()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java index b5697120d..33beb444f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionCallMethod; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -100,7 +101,7 @@ public class CallMethodActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, toSourceCall(localData, generator, arguments), scriptObject, methodName, new ActionCallMethod()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CastOpActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CastOpActionItem.java index f2708268d..b5ca4c325 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CastOpActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CastOpActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf7.ActionCastOp; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -63,7 +64,7 @@ public class CastOpActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, constructor, object, new ActionCastOp()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CharToAsciiActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CharToAsciiActionItem.java index a92d969da..8530acf25 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CharToAsciiActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CharToAsciiActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionCharToAscii; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -76,7 +77,7 @@ public class CharToAsciiActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionCharToAscii()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/CloneSpriteActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/CloneSpriteActionItem.java index 484771717..491021f8f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/CloneSpriteActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/CloneSpriteActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionCloneSprite; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -72,7 +73,7 @@ public class CloneSpriteActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, source, target, depth, new ActionCloneSprite()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java index 97a471d7e..82814ebda 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DecrementActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -73,7 +74,7 @@ public class DecrementActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, new ActionDecrement()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java index acd7c7a55..87f799600 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DefineLocalActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionDefineLocal; import com.jpexs.decompiler.flash.action.swf5.ActionDefineLocal2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -95,7 +96,7 @@ public class DefineLocalActionItem extends ActionItem implements SetTypeActionIt } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (value == null) { return toSourceMerge(localData, generator, name, new ActionDefineLocal2()); } else { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java index 38a8b312f..5601fb833 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DeleteActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionDelete; import com.jpexs.decompiler.flash.action.swf5.ActionDelete2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -67,7 +68,7 @@ public class DeleteActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (object == null) { return toSourceMerge(localData, generator, propertyName, new ActionDelete2()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java index 6211aff81..f4542b700 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -234,7 +235,7 @@ public class DirectValueActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPush(value)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/EvalActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/EvalActionItem.java index f82b48d53..d214d6525 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/EvalActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/EvalActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetVariable; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -46,7 +47,7 @@ public class EvalActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionGetVariable()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java index 6444ca3e2..4a3bbba58 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommand2ActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.flashlite.ActionFSCommand2; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -72,7 +73,7 @@ public class FSCommand2ActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); for (GraphTargetItem a : arguments) { ret.addAll(a.toSource(localData, generator)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java index 90ec87d94..440633667 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionGetURL; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -48,7 +49,7 @@ public class FSCommandActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionGetURL("FSCommand:" + command, "")); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index c91ee5ad0..2123f32d0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionDefineFunction; import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; @@ -150,7 +151,7 @@ public class FunctionActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { Set usedNames = new HashSet<>(); for (VariableActionItem v : variables) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java index 6953e594d..7cbd29f1c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetMemberActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf5.ActionGetMember; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -97,7 +98,7 @@ public class GetMemberActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, memberName, new ActionGetMember()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java index 0e291367b..d30d8f0ab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.ActionGetProperty; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -64,7 +65,7 @@ public class GetPropertyActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, target, new ActionPush((Long) (long) propertyIndex), new ActionGetProperty()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetTimeActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetTimeActionItem.java index e63090453..ed6c3736d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetTimeActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetTimeActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetTime; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -51,7 +52,7 @@ public class GetTimeActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionGetTime()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURL2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURL2ActionItem.java index 2e0c778c4..85b1f5025 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURL2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURL2ActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -76,7 +77,7 @@ public class GetURL2ActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(sendVarsMethod, false, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java index fd59cc7f6..0d667109b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetURLActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionGetURL; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -46,7 +47,7 @@ public class GetURLActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionGetURL(urlString, targetString)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java index 9db1f46f0..faa619a7f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetVariable; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -131,7 +132,7 @@ public class GetVariableActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, name, new ActionGetVariable()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GetVersionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GetVersionActionItem.java index 27a609ea7..57169ae63 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GetVersionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GetVersionActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetVariable; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -43,7 +44,7 @@ public class GetVersionActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPush("/:$version"), new ActionGetVariable()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java index ea6b403ca..407d3536a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrame2ActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGotoFrame2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -71,7 +72,7 @@ public class GotoFrame2ActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, frame, new ActionGotoFrame2(playFlag, sceneBiasFlag, sceneBias)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java index bf07bea61..d0b4520cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoFrameActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionGotoFrame; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -43,7 +44,7 @@ public class GotoFrameActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionGotoFrame(frame)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java index 8a8aac9c1..06ae1cb71 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/GotoLabelActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionGoToLabel; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -44,7 +45,7 @@ public class GotoLabelActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionGoToLabel(label)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java index 7876c7f0f..45427a260 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/IncrementActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -73,7 +74,7 @@ public class IncrementActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, new ActionIncrement()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/InitArrayActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/InitArrayActionItem.java index 29f515364..da85dbd04 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/InitArrayActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/InitArrayActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionInitArray; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -65,7 +66,7 @@ public class InitArrayActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, toSourceCall(localData, generator, values), new ActionInitArray()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java index 7983cd08c..7d8680d31 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf5.ActionInitObject; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -81,7 +82,7 @@ public class InitObjectActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); for (int i = values.size() - 1; i >= 0; i--) { ret.addAll(names.get(i).toSource(localData, generator)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieActionItem.java index 88121f9f5..bf74bdbd8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -70,7 +71,7 @@ public class LoadMovieActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, false, true)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieNumActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieNumActionItem.java index bdf0a91c1..a032fcdd9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieNumActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadMovieNumActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -72,7 +73,7 @@ public class LoadMovieNumActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, urlString, new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(method, false, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesActionItem.java index 11c9d68b5..faaf44406 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -70,7 +71,7 @@ public class LoadVariablesActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, true, true)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java index f03b91dda..b3e7f5683 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/LoadVariablesNumActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -72,7 +73,7 @@ public class LoadVariablesNumActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, urlString, new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(method, true, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java index 04088e2ff..15cfa87da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/MBAsciiToCharActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBAsciiToChar; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class MBAsciiToCharActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionMBAsciiToChar()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/MBCharToAsciiActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/MBCharToAsciiActionItem.java index e4cbf09fe..95375b6c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/MBCharToAsciiActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/MBCharToAsciiActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBCharToAscii; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class MBCharToAsciiActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionMBCharToAscii()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java index 02854812d..0565c96b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringExtractActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBStringExtract; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -72,7 +73,7 @@ public class MBStringExtractActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, index, count, new ActionMBStringExtract()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java index 5c72f73d7..5d040f91a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/MBStringLengthActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMBStringLength; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -57,7 +58,7 @@ public class MBStringLengthActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionMBStringLength()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java index d219fd3eb..7a7498206 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewMethodActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionNewMethod; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -101,7 +102,7 @@ public class NewMethodActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, toSourceCall(localData, generator, arguments), scriptObject, methodName, new ActionNewMethod()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java index 6ca5586a8..f82f6279e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NewObjectActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionNewObject; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -72,7 +73,7 @@ public class NewObjectActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, toSourceCall(localData, generator, arguments), objectName, new ActionNewObject()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/NextFrameActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/NextFrameActionItem.java index beaef791b..b4d6b302f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/NextFrameActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/NextFrameActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionNextFrame; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class NextFrameActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionNextFrame()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PlayActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PlayActionItem.java index ab9eb8a52..df237003d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PlayActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PlayActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionPlay; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class PlayActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPlay()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PopActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PopActionItem.java index d9fb91e51..1a48aef68 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PopActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PopActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionPop; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -50,7 +51,7 @@ public class PopActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java index eb99dbaca..cbf58342c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PostDecrementActionItem.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -89,7 +90,7 @@ public class PostDecrementActionItem extends ActionItem implements SetTypeAction } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); GraphTargetItem val = object; @@ -129,7 +130,7 @@ public class PostDecrementActionItem extends ActionItem implements SetTypeAction } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object.toSource(localData, generator), toSourceIgnoreReturnValue(localData, generator)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java index df719b900..e2cc5fbf7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PostIncrementActionItem.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -89,7 +90,7 @@ public class PostIncrementActionItem extends ActionItem implements SetTypeAction } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); GraphTargetItem val = object; @@ -129,7 +130,7 @@ public class PostIncrementActionItem extends ActionItem implements SetTypeAction } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object.toSource(localData, generator), toSourceIgnoreReturnValue(localData, generator)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PrevFrameActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PrevFrameActionItem.java index 10551b5a3..d13f1ec1c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PrevFrameActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PrevFrameActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionPrevFrame; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class PrevFrameActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPrevFrame()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java index 3679f16aa..39e5511b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class PrintActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, new AddActionItem(src, asGenerator.pushConstTargetItem("print:#"), boundingBox, true), target, new ActionGetURL2(0, false, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java index f1e219e04..f27ce4d24 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class PrintAsBitmapActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, new AddActionItem(src, asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), target, new ActionGetURL2(0, false, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java index 87583c417..f29d0fb0d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintAsBitmapNumActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class PrintAsBitmapNumActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, new AddActionItem(src, asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, false, false)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java index d3cddc7a2..32073e7d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/PrintNumActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,7 +64,7 @@ public class PrintNumActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, new AddActionItem(src, asGenerator.pushConstTargetItem("print:#"), boundingBox, true), new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, false, false)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/RandomNumberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/RandomNumberActionItem.java index 615367da5..d047a6242 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/RandomNumberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/RandomNumberActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionRandomNumber; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class RandomNumberActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionRandomNumber()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/RemoveSpriteActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/RemoveSpriteActionItem.java index 4d4c6e5d0..b13da888b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/RemoveSpriteActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/RemoveSpriteActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionRemoveSprite; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class RemoveSpriteActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionRemoveSprite()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ReturnActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ReturnActionItem.java index ed1232070..73ceb8b9c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ReturnActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ReturnActionItem.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionReturn; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -65,7 +66,7 @@ public class ReturnActionItem extends ActionItem implements ExitItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; List ret = new ArrayList<>(); int forinlevel = asGenerator.getForInLevel(localData); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java index 475d36e47..39cccb1d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetMemberActionItem.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; @@ -117,14 +118,14 @@ public class SetMemberActionItem extends ActionItem implements SetTypeActionItem } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; int tmpReg = asGenerator.getTempRegister(localData); return toSourceMerge(localData, generator, object, objectName, value, new ActionStoreRegister(tmpReg), new ActionSetMember(), new ActionPush(new RegisterNumber(tmpReg))); } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, object, objectName, value, new ActionSetMember()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java index 6de490fd4..622c8593b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionSetProperty; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; @@ -101,14 +102,14 @@ public class SetPropertyActionItem extends ActionItem implements SetTypeActionIt } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; int tmpReg = asGenerator.getTempRegister(localData); return toSourceMerge(localData, generator, target, new ActionPush((Long) (long) propertyIndex), value, new ActionStoreRegister(tmpReg), new ActionSetProperty(), new ActionPush(new RegisterNumber(tmpReg))); } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, target, new ActionPush((Long) (long) propertyIndex), value, new ActionSetProperty()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTarget2ActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTarget2ActionItem.java index 8efc4694f..d97b98f3e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTarget2ActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTarget2ActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -51,7 +52,7 @@ public class SetTarget2ActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { throw new UnsupportedOperationException(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java index 45405146f..f66ed6d61 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetTargetActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -41,7 +42,7 @@ public class SetTargetActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { throw new UnsupportedOperationException(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java index ae11e8264..de1dc0876 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/SetVariableActionItem.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionSetVariable; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; @@ -115,14 +116,14 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; int tmpReg = asGenerator.getTempRegister(localData); return toSourceMerge(localData, generator, name, value, new ActionStoreRegister(tmpReg), new ActionSetVariable(), new ActionPush(new RegisterNumber(tmpReg))); } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, name, value, new ActionSetVariable()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java index 63fd9e459..bf7807c3b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StartDragActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStartDrag; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -88,7 +89,7 @@ public class StartDragActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { boolean hasConstrains = true; if (constrain instanceof DirectValueActionItem) { if (Double.compare(EcmaScript.toNumber(constrain.getResult()), 0) == 0) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StopActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StopActionItem.java index 7ae0b8b99..342f7c8fe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StopActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StopActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionStop; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class StopActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionStop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StopAllSoundsActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StopAllSoundsActionItem.java index 693b4a6ec..5a824d1b0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StopAllSoundsActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StopAllSoundsActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionStopSounds; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class StopAllSoundsActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionStopSounds()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StopDragActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StopDragActionItem.java index 3c3e32e3f..94965de6d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StopDragActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StopDragActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionEndDrag; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -38,7 +39,7 @@ public class StopDragActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionEndDrag()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java index 26d979fee..48495d6f3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StoreRegisterActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; @@ -96,7 +97,7 @@ public class StoreRegisterActionItem extends ActionItem implements SetTypeAction } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionStoreRegister(register.number)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java index 81dbec2ad..f8fb0d4ac 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StringExtractActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStringExtract; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -61,7 +62,7 @@ public class StringExtractActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, index, count, new ActionStringExtract()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java index 1e2c6f2d6..210566a54 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/StringLengthActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStringLength; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -49,7 +50,7 @@ public class StringLengthActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionStringLength()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java index fdabc0f7d..9676ba5b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/TargetPathActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionTargetPath; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class TargetPathActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionTargetPath()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ThrowActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ThrowActionItem.java index 9665d0e86..270009767 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ThrowActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ThrowActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf7.ActionThrow; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -47,7 +48,7 @@ public class ThrowActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionThrow()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java index 8d86631d4..059dc04f9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ToIntegerActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionToInteger; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class ToIntegerActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionToInteger()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java index ccfec3932..a8acf3ec0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ToNumberActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionToNumber; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class ToNumberActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionToNumber()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ToStringActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ToStringActionItem.java index a83f944bb..dc17fd409 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ToStringActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ToStringActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionToString; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class ToStringActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionToString()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/ToggleHighQualityActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/ToggleHighQualityActionItem.java index be64b1e07..0c3acb89c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/ToggleHighQualityActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/ToggleHighQualityActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf3.ActionToggleQuality; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; @@ -43,7 +44,7 @@ public class ToggleHighQualityActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionToggleQuality()); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/TraceActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/TraceActionItem.java index 05df3341d..026c79e49 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/TraceActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/TraceActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionTrace; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -50,7 +51,7 @@ public class TraceActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionTrace()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java index 198ce5523..ce7341cd8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/TypeOfActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionTypeOf; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -84,7 +85,7 @@ public class TypeOfActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, value, new ActionTypeOf()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java index 5753353d4..45a6128c1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -57,7 +58,7 @@ public class UnLoadMovieActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, new ActionPush(""), targetString, new ActionGetURL2(0, false, true)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java index 4f226d9e2..c7ffd9954 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/UnLoadMovieNumActionItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -59,7 +60,7 @@ public class UnLoadMovieNumActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; return toSourceMerge(localData, generator, new ActionPush(""), new AddActionItem(src, asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, false, true)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java index a8557bfc8..822f93a7f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ClassActionItem.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.collections.MyEntry; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -210,7 +211,7 @@ public class ClassActionItem extends ActionItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; SourceGeneratorLocalData localData2 = Helper.deepCopy(localData); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java index 0c25383c3..1a482a188 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/ForInActionItem.java @@ -35,6 +35,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -119,7 +120,7 @@ public class ForInActionItem extends LoopActionItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; HashMap registerVars = asGenerator.getRegisterVars(localData); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java index b997c1451..ea04fefb3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/IfFrameLoadedActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.action.swf4.ActionWaitForFrame2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -76,7 +77,7 @@ public class IfFrameLoadedActionItem extends ActionItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List body = generator.generate(localData, actions); return toSourceMerge(localData, generator, frame, new ActionWaitForFrame2(body.size()), body); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java index 3c9870ef4..85c101a72 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/InterfaceActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -68,7 +69,7 @@ public class InterfaceActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; ret.addAll(asGenerator.generateTraits(localData, true, name, null, superInterfaces, null, null, null, null, null)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java index 952d79229..2f7eacb5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TellTargetActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.action.swf3.ActionSetTarget; import com.jpexs.decompiler.flash.action.swf4.ActionSetTarget2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -64,7 +65,7 @@ public class TellTargetActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(target.toSource(localData, generator)); ret.add(new ActionSetTarget2()); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java index b4c1dc01e..02f14a92f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionJump; import com.jpexs.decompiler.flash.action.swf7.ActionTry; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -150,7 +151,7 @@ public class TryActionItem extends ActionItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List ret = new ArrayList<>(); ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; List tryCommandsA = asGenerator.toActionList(asGenerator.generate(localData, tryCommands)); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java index f9f24607b..af8c8efe5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/clauses/WithActionItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.action.swf5.ActionWith; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -65,7 +66,7 @@ public class WithActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { List data = generator.generate(localData, items); List dataA = new ArrayList<>(); for (GraphSourceItem s : data) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java index 0e098f836..c04570612 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionAdd2; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.EcmaType; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -74,11 +75,11 @@ public class AddActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionAdd2()); } - - @Override + + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java index b9aa3416f..30a5e46e9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionAnd; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class AndActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionAnd()); } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java index 4f5da73d5..b045a1264 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitAnd; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class BitAndActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitAnd()); } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java index c822b105e..9a45d6d69 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitOr; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class BitOrActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitOr()); } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java index e070c4dc9..aa7c29827 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitXor; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class BitXorActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitXor()); } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java index 723dcf385..11488c82a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionDivide; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -41,10 +42,10 @@ public class DivideActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionDivide()); } - + @Override public GraphTargetItem returnType() { return new UnboundedTypeItem(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java index db9b63c34..e6203030e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -53,10 +54,10 @@ public class EqActionItem extends BinaryOpItem implements LogicalOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionEquals2()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java index cb400a318..b98fdcea8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -61,10 +62,10 @@ public class GeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionLess2(), new ActionNot()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java index 56ed24f90..31fa332c5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf6.ActionGreater; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -44,10 +45,10 @@ public class GtActionItem extends BinaryOpItem implements LogicalOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionGreater()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java index 24a1c0d8a..f47e3c529 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java @@ -33,7 +33,7 @@ public class InActionItem extends BinaryOpItem { public boolean isCompileTime(Set dependencies) { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java index de4c35c0c..669413465 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf6.ActionInstanceOf; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class InstanceOfActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionInstanceOf()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java index ffa0aca5a..3c9105f84 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitLShift; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class LShiftActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitLShift()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java index 86080f37d..b86f47a6a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf6.ActionGreater; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -52,10 +53,10 @@ public class LeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionGreater(), new ActionNot()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java index bec14b23e..80c559077 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -53,11 +54,11 @@ public class LtActionItem extends BinaryOpItem implements LogicalOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionLess2()); } - - @Override + + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java index 40c0b267d..453b381cd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionModulo; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -41,10 +42,10 @@ public class ModuloActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionModulo()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java index eb5e1413a..3693424d9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionMultiply; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class MultiplyActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionMultiply()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java index 0bd99f3b8..068c9bf75 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -54,11 +55,11 @@ public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Invert } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionEquals2(), new ActionNot()); } - - @Override + + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java index 9cecf23e0..c9d75caad 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionOr; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,11 +39,11 @@ public class OrActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionOr()); } - - @Override + + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java index 5040b81a5..eebe1d8e1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionDecrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -50,7 +51,7 @@ public class PreDecrementActionItem extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; List ret = new ArrayList<>(); GraphTargetItem val = value; @@ -93,8 +94,7 @@ public class PreDecrementActionItem extends UnaryOpItem { } return ret; } - - + @Override public GraphTargetItem returnType() { return value.returnType(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java index 441786468..fbfb19ce9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionIncrement; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -50,7 +51,7 @@ public class PreIncrementActionItem extends UnaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator; List ret = new ArrayList<>(); GraphTargetItem val = value; @@ -93,7 +94,7 @@ public class PreIncrementActionItem extends UnaryOpItem { } return ret; } - + @Override public GraphTargetItem returnType() { return value.returnType(); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java index dbaa91a04..11067f76f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitRShift; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class RShiftActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitRShift()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java index e83f6d6b7..2493f00b7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf6.ActionStrictEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -47,10 +48,10 @@ public class StrictEqActionItem extends BinaryOpItem implements LogicalOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStrictEquals()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java index d63d71ad5..b27b9255f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf6.ActionStrictEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -48,10 +49,10 @@ public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStrictEquals(), new ActionNot()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java index b3a49e76a..a259e31d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStringAdd; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class StringAddActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStringAdd()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java index 1be1385ca..fb0384a3c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStringEquals; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class StringEqActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStringEquals()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java index 76b20ce81..7eef92704 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class StringLtActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStringLess()); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java index 81b97c7be..3776d51ff 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionSubtract; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -63,10 +64,10 @@ public class SubtractActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionSubtract()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java index 47efeba96..c156d6373 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf5.ActionBitURShift; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,10 +39,10 @@ public class URShiftActionItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionBitURShift()); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index 9216c56aa..89ccea6f5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -114,6 +114,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.collections.MyEntry; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.model.AndItem; @@ -1708,7 +1709,7 @@ public class ActionScriptParser { return retTree; } - public List actionsFromTree(List tree, List constantPool) { + public List actionsFromTree(List tree, List constantPool) throws CompilationException { ActionSourceGenerator gen = new ActionSourceGenerator(constantPool); List ret = new ArrayList<>(); SourceGeneratorLocalData localData = new SourceGeneratorLocalData( @@ -1723,7 +1724,7 @@ public class ActionScriptParser { return ret; } - public List actionsFromString(String s) throws ParseException, IOException { + public List actionsFromString(String s) throws ParseException, IOException, CompilationException { List constantPool = new ArrayList<>(); List tree = treeFromString(s, constantPool); return actionsFromTree(tree, constantPool); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java index b09d16192..9aeefb3dc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java @@ -45,6 +45,7 @@ import com.jpexs.decompiler.flash.action.swf7.ActionExtends; import com.jpexs.decompiler.flash.action.swf7.ActionImplementsOp; import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.helpers.collections.MyEntry; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -73,7 +74,7 @@ import java.util.List; public class ActionSourceGenerator implements SourceGenerator { @Override - public List generate(SourceGeneratorLocalData localData, AndItem item) { + public List generate(SourceGeneratorLocalData localData, AndItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); ret.add(new ActionPushDuplicate()); @@ -88,7 +89,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, OrItem item) { + public List generate(SourceGeneratorLocalData localData, OrItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); ret.add(new ActionPushDuplicate()); @@ -117,7 +118,7 @@ public class ActionSourceGenerator implements SourceGenerator { return list; } - private List generateIf(SourceGeneratorLocalData localData, GraphTargetItem expression, List onTrueCmds, List onFalseCmds, boolean ternar) { + private List generateIf(SourceGeneratorLocalData localData, GraphTargetItem expression, List onTrueCmds, List onFalseCmds, boolean ternar) throws CompilationException { List ret = new ArrayList<>(); if (expression instanceof Inverted) { ret.addAll(((Inverted) expression).invert().toSource(localData, this)); @@ -169,7 +170,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, IfItem item) { + public List generate(SourceGeneratorLocalData localData, IfItem item) throws CompilationException { return generateIf(localData, item.expression, item.onTrue, item.onFalse, false); } @@ -196,7 +197,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, TernarOpItem item) { + public List generate(SourceGeneratorLocalData localData, TernarOpItem item) throws CompilationException { List onTrue = new ArrayList<>(); onTrue.add(item.onTrue); List onFalse = new ArrayList<>(); @@ -205,7 +206,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, WhileItem item) { + public List generate(SourceGeneratorLocalData localData, WhileItem item) throws CompilationException { List ret = new ArrayList<>(); List whileExpr = new ArrayList<>(); @@ -234,7 +235,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, DoWhileItem item) { + public List generate(SourceGeneratorLocalData localData, DoWhileItem item) throws CompilationException { List ret = new ArrayList<>(); List doExpr = generateToActionList(localData, item.expression); List doBody = generateToActionList(localData, item.commands); @@ -252,7 +253,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, ForItem item) { + public List generate(SourceGeneratorLocalData localData, ForItem item) throws CompilationException { List ret = new ArrayList<>(); List forExpr = generateToActionList(localData, item.expression); List forBody = generateToActionList(localData, item.commands); @@ -284,7 +285,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, SwitchItem item) { + public List generate(SourceGeneratorLocalData localData, SwitchItem item) throws CompilationException { List ret = new ArrayList<>(); HashMap registerVars = getRegisterVars(localData); int exprReg = 0; @@ -394,7 +395,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, NotItem item) { + public List generate(SourceGeneratorLocalData localData, NotItem item) throws CompilationException { if (item.getOriginal() instanceof Inverted) { GraphTargetItem norig = ((Inverted) item).invert(); return norig.toSource(localData, this); @@ -430,16 +431,16 @@ public class ActionSourceGenerator implements SourceGenerator { return ret; } - private List generateToActionList(SourceGeneratorLocalData localData, List commands) { + private List generateToActionList(SourceGeneratorLocalData localData, List commands) throws CompilationException { return toActionList(generate(localData, commands)); } - private List generateToActionList(SourceGeneratorLocalData localData, GraphTargetItem command) { + private List generateToActionList(SourceGeneratorLocalData localData, GraphTargetItem command) throws CompilationException { return toActionList(command.toSource(localData, this)); } @Override - public List generate(SourceGeneratorLocalData localData, List commands) { + public List generate(SourceGeneratorLocalData localData, List commands) throws CompilationException { List ret = new ArrayList<>(); for (GraphTargetItem item : commands) { ret.addAll(item.toSourceIgnoreReturnValue(localData, this)); @@ -621,7 +622,7 @@ public class ActionSourceGenerator implements SourceGenerator { return new ActionPush(new ConstantIndex(index)); } - public List generateTraits(SourceGeneratorLocalData localData, boolean isInterface, GraphTargetItem name, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List functions, List> vars, List staticFunctions, List> staticVars) { + public List generateTraits(SourceGeneratorLocalData localData, boolean isInterface, GraphTargetItem name, GraphTargetItem extendsVal, List implementsStr, GraphTargetItem constructor, List functions, List> vars, List staticFunctions, List> staticVars) throws CompilationException { List extendsStr = getVarParts(extendsVal); List ret = new ArrayList<>(); List nameStr = getVarParts(name); @@ -749,7 +750,7 @@ public class ActionSourceGenerator implements SourceGenerator { } @Override - public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item) { + public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item) throws CompilationException { if (item.commands.isEmpty()) { return new ArrayList<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java index a74ba0441..884d44390 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.parser.script; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -84,7 +85,7 @@ public class VariableActionItem extends ActionItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (it == null) { return new ArrayList<>(); } @@ -92,7 +93,7 @@ public class VariableActionItem extends ActionItem { } @Override - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { if (it == null) { return new ArrayList<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 9da5cd52d..337a06b0c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -278,7 +278,7 @@ public class CommandLineArgumentParser { } else if (nextParam.equals("-dumpswf")) { parseDumpSwf(args); } else if (nextParam.equals("-as3compiler")) { - ActionScriptParser.compile(args.remove(),args.remove()); + ActionScriptParser.compile(args.remove(), args.remove()); } else if (nextParam.equals("-help") || nextParam.equals("--help") || nextParam.equals("/?")) { printHeader(); printCmdLineUsage(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ButtonsPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/ButtonsPanel.java index d576f98cf..631a5f6de 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ButtonsPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ButtonsPanel.java @@ -32,10 +32,10 @@ import javax.swing.JPanel; public class ButtonsPanel extends JPanel { private ComponentListener listener; - + public ButtonsPanel() { super(new FlowLayout()); - + listener = new ComponentListener() { @Override @@ -56,7 +56,7 @@ public class ButtonsPanel extends JPanel { updateVisibility(); } }; - + this.addContainerListener(new ContainerListener() { @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java index 876c662eb..aa2510406 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FontPanel.java @@ -53,7 +53,7 @@ public class FontPanel extends javax.swing.JPanel { public FontTag getFontTag() { return fontTag; } - + public void clear() { fontTag = null; } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 36c9a664f..fdd5ae586 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -538,7 +538,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis if (timeline.getFrameCount() <= frame) { return; } - + getOutlines(); Matrix mat = new Matrix(); mat.translateX = swf.displayRect.Xmin; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 4e609fca4..f49ff7323 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -391,7 +391,7 @@ public class Main { final SWFList swfs1 = swfs; final boolean first1 = first; first = false; - if(firstSWF == null){ + if (firstSWF == null) { firstSWF = swfs1.get(0); } try { @@ -892,11 +892,11 @@ public class Main { * @param args the command line arguments * @throws IOException */ - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws IOException { startFreeMemThread(); initLogging(Configuration.debugMode.get()); initLang(); - + if (Configuration.cacheOnDisk.get()) { Cache.setStorageType(Cache.STORAGE_FILES); } else { @@ -1059,7 +1059,7 @@ public class Main { Socket sock = new Socket("www.free-decompiler.com", 80); OutputStream os = sock.getOutputStream(); String currentLoc = Configuration.locale.get("en"); - os.write(("GET /flash/update.html?action=check¤tVersion=" + URLEncoder.encode(ApplicationInfo.version,"UTF-8") + "¤tBuild=" + URLEncoder.encode(ApplicationInfo.build,"UTF-8") + "¤tNightly=" + (ApplicationInfo.nightly?"1":"0") + " HTTP/1.1\r\n" + os.write(("GET /flash/update.html?action=check¤tVersion=" + URLEncoder.encode(ApplicationInfo.version, "UTF-8") + "¤tBuild=" + URLEncoder.encode(ApplicationInfo.build, "UTF-8") + "¤tNightly=" + (ApplicationInfo.nightly ? "1" : "0") + " HTTP/1.1\r\n" + "Host: www.free-decompiler.com\r\n" + "X-Accept-Versions: " + acceptVersions + "\r\n" + "X-Update-Major: " + UPDATE_SYSTEM_MAJOR + "\r\n" diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java index bcec7f11c..394d98383 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -275,7 +275,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec statusPanel.setStatus(s); } - public void setWorkStatus(String s, CancellableWorker worker) { statusPanel.setWorkStatus(s, worker); } @@ -351,7 +350,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec if (item instanceof ImageTag && ((ImageTag) item).importSupported()) { replaceSelectionMenuItem.setVisible(true); } - + if (item instanceof DefineBinaryDataTag) { replaceSelectionMenuItem.setVisible(true); } @@ -560,7 +559,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec displayPanel = new JPanel(new CardLayout()); - previewPanel = new PreviewPanel(this, flashPanel); displayPanel.add(previewPanel, CARDPREVIEWPANEL); displayPanel.add(createFolderPreviewCard(), CARDFOLDERPREVIEWPANEL); @@ -721,8 +719,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec updateUi(swf); /*if (first && Configuration.gotoMainClassOnStartup.get()) { - gotoDocumentClass(swf); - }*/ + gotoDocumentClass(swf); + }*/ first = false; } } @@ -2172,7 +2170,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec public boolean isInternalFlashViewerSelected() { return mainMenu.isInternalFlashViewerSelected(); } - + public void reload(boolean forceReload) { TreeNode treeNode = (TreeNode) tagTree.getLastSelectedPathComponent(); if (treeNode == null) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index aa3b792fd..21bef3a14 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -106,17 +106,17 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private static final String CARDTEXTPANEL = "Text card"; private static final String CARDFONTPANEL = "Font card"; - + private static final String ACTION_EDIT_GENERIC_TAG = "EDITGENERICTAG"; private static final String ACTION_SAVE_GENERIC_TAG = "SAVEGENERICTAG"; private static final String ACTION_CANCEL_GENERIC_TAG = "CANCELGENERICTAG"; private static final String ACTION_PREV_FONTS = "PREVFONTS"; private static final String ACTION_NEXT_FONTS = "NEXTFONTS"; - + private final MainPanel mainPanel; private final JPanel viewerCards; - + private PlayerControls flashControls; private final FlashPlayerPanel flashPanel; private File tempFile; @@ -146,7 +146,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { private FontPanel fontPanel; private int fontPageNum; private TextPanel textPanel; - + private boolean splitsInited; public PreviewPanel(MainPanel mainPanel, FlashPlayerPanel flashPanel) { @@ -165,18 +165,18 @@ public class PreviewPanel extends JSplitPane implements ActionListener { viewerCards = new JPanel(); viewerCards.setLayout(new CardLayout()); - + viewerCards.add(createFlashPlayerPanel(flashPanel), FLASH_VIEWER_CARD); viewerCards.add(createImagesCard(), DRAW_PREVIEW_CARD); viewerCards.add(createBinaryCard(), BINARY_TAG_CARD); viewerCards.add(createGenericTagCard(), GENERIC_TAG_CARD); setLeftComponent(viewerCards); - + createParametersPanel(); showCardLeft(FLASH_VIEWER_CARD); } - + private void createParametersPanel() { displayWithPreview = new JPanel(new CardLayout()); @@ -195,7 +195,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { parametersPanel.add(displayWithPreview, BorderLayout.CENTER); setRightComponent(parametersPanel); } - + private JPanel createImageButtonsPanel() { replaceImageButton = new JButton(mainPanel.translate("button.replace"), View.getIcon("edit16")); replaceImageButton.setMargin(new Insets(3, 3, 3, 10)); @@ -208,31 +208,31 @@ public class PreviewPanel extends JSplitPane implements ActionListener { prevFontsButton.setActionCommand(ACTION_PREV_FONTS); prevFontsButton.addActionListener(this); prevFontsButton.setVisible(false); - + nextFontsButton = new JButton(mainPanel.translate("button.next"), View.getIcon("next16")); nextFontsButton.setMargin(new Insets(3, 3, 3, 10)); nextFontsButton.setActionCommand(ACTION_NEXT_FONTS); nextFontsButton.addActionListener(this); nextFontsButton.setVisible(false); - + ButtonsPanel imageButtonsPanel = new ButtonsPanel(); imageButtonsPanel.add(replaceImageButton); imageButtonsPanel.add(prevFontsButton); imageButtonsPanel.add(nextFontsButton); return imageButtonsPanel; } - + private JPanel createBinaryButtonsPanel() { replaceBinaryButton = new JButton(mainPanel.translate("button.replace"), View.getIcon("edit16")); replaceBinaryButton.setMargin(new Insets(3, 3, 3, 10)); replaceBinaryButton.setActionCommand(MainPanel.ACTION_REPLACE); replaceBinaryButton.addActionListener(mainPanel); - + ButtonsPanel binaryButtonsPanel = new ButtonsPanel(); binaryButtonsPanel.add(replaceBinaryButton); return binaryButtonsPanel; } - + private JPanel createGenericTagButtonsPanel() { editButton = new JButton(mainPanel.translate("button.edit"), View.getIcon("edit16")); editButton.setMargin(new Insets(3, 3, 3, 10)); @@ -248,14 +248,14 @@ public class PreviewPanel extends JSplitPane implements ActionListener { cancelButton.setActionCommand(ACTION_CANCEL_GENERIC_TAG); cancelButton.addActionListener(this); cancelButton.setVisible(false); - + ButtonsPanel genericTagButtonsPanel = new ButtonsPanel(); genericTagButtonsPanel.add(editButton); genericTagButtonsPanel.add(saveButton); genericTagButtonsPanel.add(cancelButton); return genericTagButtonsPanel; } - + private JPanel createFlashPlayerPanel(FlashPlayerPanel flashPanel) { JPanel pan = new JPanel(new BorderLayout()); JLabel prevLabel = new HeaderLabel(mainPanel.translate("swfpreview")); @@ -294,7 +294,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { pan.add(leftComponent, BorderLayout.CENTER); return pan; } - + private JPanel createImagesCard() { JPanel shapesCard = new JPanel(new BorderLayout()); JPanel previewPanel = new JPanel(new BorderLayout()); @@ -336,12 +336,12 @@ public class PreviewPanel extends JSplitPane implements ActionListener { CardLayout cl = (CardLayout) (viewerCards.getLayout()); cl.show(viewerCards, card); } - + private void showCardRight(String card) { CardLayout cl = (CardLayout) (displayWithPreview.getLayout()); cl.show(displayWithPreview, card); } - + public void setSplitsInited() { splitsInited = true; } @@ -349,11 +349,11 @@ public class PreviewPanel extends JSplitPane implements ActionListener { public TextPanel getTextPanel() { return textPanel; } - + public void setParametersPanelVisible(boolean show) { parametersPanel.setVisible(show); } - + public void showFlashViewerPanel() { parametersPanel.setVisible(false); showCardLeft(FLASH_VIEWER_CARD); @@ -365,18 +365,18 @@ public class PreviewPanel extends JSplitPane implements ActionListener { imagePlayControls.setMedia(imagePanel); imagePanel.setTimelined(timelined, swf, frame); } - + public void showImagePanel(SerializableImage image) { showCardLeft(DRAW_PREVIEW_CARD); parametersPanel.setVisible(false); imagePlayControls.setMedia(imagePanel); imagePanel.setImage(image); } - + public void setMedia(MediaDisplay media) { imagePlayControls.setMedia(media); } - + public void showFontPanel(FontTag fontTag) { fontPageNum = 0; showFontPage(fontTag); @@ -398,7 +398,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { showImagePanel(MainPanel.makeTimelined(fontTag), fontTag.getSwf(), fontPageNum); } } - + public static int getFontPageCount(FontTag fontTag) { int pageCount = (fontTag.getGlyphShapeTable().size() - 1) / SHAPERECORD.MAX_CHARACTERS_IN_FONT_PREVIEW + 1; if (pageCount < 1) { @@ -406,7 +406,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { } return pageCount; } - + public void showTextPanel(TextTag textTag) { if (mainPanel.isInternalFlashViewerSelected() /*|| ft instanceof GFxDefineCompactedFont*/) { showImagePanel(MainPanel.makeTimelined(textTag), textTag.getSwf(), 0); @@ -417,24 +417,24 @@ public class PreviewPanel extends JSplitPane implements ActionListener { setDividerLocation(Configuration.guiPreviewSplitPaneDividerLocation.get(getWidth() / 2)); textPanel.setText(textTag.getFormattedText()); } - + public void setEditText(boolean edit) { textPanel.setEditText(edit); } - + public void clear() { imagePanel.stop(); binaryPanel.setBinaryData(null); genericTagPanel.clear(); fontPanel.clear(); } - + public void showBinaryPanel(byte[] data) { showCardLeft(BINARY_TAG_CARD); binaryPanel.setBinaryData(data); parametersPanel.setVisible(false); } - + public void showGenericTagPanel(Tag tag) { showCardLeft(GENERIC_TAG_CARD); editButton.setVisible(true); @@ -443,7 +443,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { genericTagPanel.setEditMode(false, tag); parametersPanel.setVisible(false); } - + public void setImageReplaceButtonVisible(boolean show) { replaceImageButton.setVisible(show); prevFontsButton.setVisible(false); @@ -863,7 +863,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { Logger.getLogger(PreviewPanel.class.getName()).log(Level.SEVERE, "Cannot create tempfile", iex); } } - + @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java b/trunk/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java index e153447b0..de566a073 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java @@ -117,7 +117,7 @@ public class SoundTagPlayer implements MediaDisplay { } } } - + public void play(boolean async) { waitStop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/TextPanel.java index c89cfe78b..ad1853a42 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -34,7 +34,7 @@ import javax.swing.JScrollPane; * @author JPEXS */ public class TextPanel extends JPanel implements ActionListener { - + private static final String ACTION_EDIT_TEXT = "EDITTEXT"; private static final String ACTION_CANCEL_TEXT = "CANCELTEXT"; private static final String ACTION_SAVE_TEXT = "SAVETEXT"; @@ -87,14 +87,14 @@ public class TextPanel extends JPanel implements ActionListener { public SearchPanel getSearchPanel() { return textSearchPanel; } - + public void setText(String text) { textValue.setContentType("text/swf_text"); // textValue.setFont(new Font("Monospaced", Font.PLAIN, 13)); textValue.setText(text); textValue.setCaretPosition(0); } - + public void setEditText(boolean edit) { textValue.setEditable(edit); textSaveButton.setVisible(edit); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java index 576e36ce1..37831aef7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/NamespaceTableModel.java @@ -123,7 +123,7 @@ public class NamespaceTableModel implements TableModel { return "-"; } String val = abc.constants.getNamespace(rowIndex).getName(abc.constants); - if(val == null){ + if (val == null) { val = "-"; } return val; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index c58aafd73..7d1c4c220 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -42,6 +42,7 @@ import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.hilight.Highlighting; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.treenodes.TreeNode; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.helpers.Cache; import com.jpexs.helpers.CancellableWorker; @@ -759,6 +760,8 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex); } catch (ParseException ex) { View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + } catch (CompilationException ex) { + View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); } break; } diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java b/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java index 7297326ff..2c794aef5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/CodeFormatting.java @@ -25,7 +25,7 @@ public class CodeFormatting { public String newLineChars = "\r\n"; public String indentString = " "; public boolean beginBlockOnNewLine = true; - + // spaces // before parentheses public boolean spaceBeforeParenthesesMethodCallParentheses = false; diff --git a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java index 45527a91f..454979384 100644 --- a/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java +++ b/trunk/src/com/jpexs/decompiler/flash/helpers/GraphTextWriter.java @@ -173,11 +173,11 @@ public abstract class GraphTextWriter { public GraphTextWriter endBlock() { return endBlock("}"); } - + public GraphTextWriter space() { return append(" "); } - + public GraphTextWriter spaceBeforeCallParenthesies(int argCount) { if (argCount > 0) { if (formatting.spaceBeforeParenthesesMethodCallParentheses) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 5480ddc34..0851bddb8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -325,14 +325,14 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable @Override public boolean isModified() { - if(super.isModified()){ + if (super.isModified()) { return true; } - for(Tag t:subTags){ - if(t.isModified()){ + for (Tag t : subTags) { + if (t.isModified()) { return true; } } return false; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java index 818792aa3..9d4de8838 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/JPEGTablesTag.java @@ -24,5 +24,6 @@ public class JPEGTablesTag extends Tag { public static final int ID = 8; public JPEGTablesTag(SWF swf, byte[] headerData, byte[] data, long pos) throws IOException { - super(swf, ID, "JPEGTables", headerData, data, pos); } + super(swf, ID, "JPEGTables", headerData, data, pos); + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java index a0b908901..95a15af76 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -362,7 +362,7 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ } return baos.toByteArray(); } - + /** * Writes Tag value to the stream * @@ -376,7 +376,7 @@ public class Tag implements NeedsCharacters, Exportable, ContainerItem, Serializ sos.write(newData); return; } - + sos.write(headerData); sos.write(data); } diff --git a/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 64c2c5948..2d6fc3e80 100644 --- a/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/trunk/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -330,7 +330,7 @@ public class Timeline { } return true; } - + private boolean isSingleFrame(int frame) { Frame frameObj = frames.get(frame); for (int i = 1; i <= getMaxDepth(); i++) { diff --git a/trunk/src/com/jpexs/decompiler/graph/CompilationException.java b/trunk/src/com/jpexs/decompiler/graph/CompilationException.java new file mode 100644 index 000000000..b6fa3d8a0 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/graph/CompilationException.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2014 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.graph; + +/** + * + * @author JPEXS + */ +public class CompilationException extends Exception { + + public int line; + public String text; + + public CompilationException(String message, int line) { + super("Compilation error on line " + line + ": " + message); + this.line = line; + this.text = message; + } + +} diff --git a/trunk/src/com/jpexs/decompiler/graph/Graph.java b/trunk/src/com/jpexs/decompiler/graph/Graph.java index 25a067cea..eab389b5d 100644 --- a/trunk/src/com/jpexs/decompiler/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/graph/Graph.java @@ -89,7 +89,6 @@ public class Graph { } } - public GraphPart deepCopy(GraphPart part, List visited, List copies) { if (visited == null) { visited = new ArrayList<>(); diff --git a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java index 859eec944..553d7c87a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -201,11 +201,11 @@ public abstract class GraphTargetItem implements Serializable { return equals(target); } - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return new ArrayList<>(); } - public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSource(localData, generator); } @@ -215,7 +215,7 @@ public abstract class GraphTargetItem implements Serializable { return ret; } - public static List toSourceMerge(SourceGeneratorLocalData localData, SourceGenerator gen, Object... tar) { + public static List toSourceMerge(SourceGeneratorLocalData localData, SourceGenerator gen, Object... tar) throws CompilationException { List ret = new ArrayList<>(); for (Object o : tar) { if (o == null) { diff --git a/trunk/src/com/jpexs/decompiler/graph/MarkItem.java b/trunk/src/com/jpexs/decompiler/graph/MarkItem.java index 17d4dcadb..8baa4a3ac 100644 --- a/trunk/src/com/jpexs/decompiler/graph/MarkItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/MarkItem.java @@ -51,9 +51,9 @@ public class MarkItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java b/trunk/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java index ae48a5707..a9e14c6ec 100644 --- a/trunk/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java @@ -55,9 +55,9 @@ public class NotCompileTimeItem extends GraphTargetItem { public boolean hasReturnValue() { return object.hasReturnValue(); } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/SourceGenerator.java b/trunk/src/com/jpexs/decompiler/graph/SourceGenerator.java index dd0b629aa..7871550bc 100644 --- a/trunk/src/com/jpexs/decompiler/graph/SourceGenerator.java +++ b/trunk/src/com/jpexs/decompiler/graph/SourceGenerator.java @@ -38,31 +38,31 @@ import java.util.List; */ public interface SourceGenerator { - public List generate(SourceGeneratorLocalData localData, AndItem item); + public List generate(SourceGeneratorLocalData localData, AndItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, OrItem item); + public List generate(SourceGeneratorLocalData localData, OrItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, IfItem item); + public List generate(SourceGeneratorLocalData localData, IfItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, TernarOpItem item); + public List generate(SourceGeneratorLocalData localData, TernarOpItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, WhileItem item); + public List generate(SourceGeneratorLocalData localData, WhileItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, DoWhileItem item); + public List generate(SourceGeneratorLocalData localData, DoWhileItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, ForItem item); + public List generate(SourceGeneratorLocalData localData, ForItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, SwitchItem item); + public List generate(SourceGeneratorLocalData localData, SwitchItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, NotItem item); + public List generate(SourceGeneratorLocalData localData, NotItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, DuplicateItem item); + public List generate(SourceGeneratorLocalData localData, DuplicateItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, BreakItem item); + public List generate(SourceGeneratorLocalData localData, BreakItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, ContinueItem item); + public List generate(SourceGeneratorLocalData localData, ContinueItem item) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, List commands); + public List generate(SourceGeneratorLocalData localData, List commands) throws CompilationException; - public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item); + public List generate(SourceGeneratorLocalData localData, CommaExpressionItem item) throws CompilationException; } diff --git a/trunk/src/com/jpexs/decompiler/graph/TypeFunctionItem.java b/trunk/src/com/jpexs/decompiler/graph/TypeFunctionItem.java index e9188529d..47ca12e33 100644 --- a/trunk/src/com/jpexs/decompiler/graph/TypeFunctionItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/TypeFunctionItem.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.graph; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -26,17 +25,17 @@ import java.util.Objects; * * @author JPEXS */ -public class TypeFunctionItem extends GraphTargetItem{ +public class TypeFunctionItem extends GraphTargetItem { public static TypeFunctionItem BOOLEAN = new TypeFunctionItem("Boolean"); public static TypeFunctionItem STRING = new TypeFunctionItem("String"); public static TypeFunctionItem ARRAY = new TypeFunctionItem("Array"); public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem(); - + public String fullTypeName; - + public TypeFunctionItem(String fullTypeName) { - super(null,NOPRECEDENCE); + super(null, NOPRECEDENCE); this.fullTypeName = fullTypeName; } @@ -62,17 +61,12 @@ public class TypeFunctionItem extends GraphTargetItem{ return true; } - - @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append(fullTypeName); return writer; } - - - @Override public GraphTargetItem returnType() { return this; @@ -82,10 +76,10 @@ public class TypeFunctionItem extends GraphTargetItem{ public boolean hasReturnValue() { return true; } - + @Override public String toString() { - return "Function["+fullTypeName+"]"; + return "Function[" + fullTypeName + "]"; } - + } diff --git a/trunk/src/com/jpexs/decompiler/graph/TypeItem.java b/trunk/src/com/jpexs/decompiler/graph/TypeItem.java index da13f5ef5..1b8aad9e3 100644 --- a/trunk/src/com/jpexs/decompiler/graph/TypeItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/TypeItem.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.jpexs.decompiler.graph; import com.jpexs.decompiler.flash.abc.ABC; @@ -31,17 +30,17 @@ import java.util.Objects; * * @author JPEXS */ -public class TypeItem extends GraphTargetItem{ +public class TypeItem extends GraphTargetItem { public static TypeItem BOOLEAN = new TypeItem("Boolean"); public static TypeItem STRING = new TypeItem("String"); public static TypeItem ARRAY = new TypeItem("Array"); public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem(); - + public String fullTypeName; - + public TypeItem(String fullTypeName) { - super(null,NOPRECEDENCE); + super(null, NOPRECEDENCE); this.fullTypeName = fullTypeName; } @@ -67,17 +66,12 @@ public class TypeItem extends GraphTargetItem{ return true; } - - @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append(fullTypeName); return writer; } - - - @Override public GraphTargetItem returnType() { return this; @@ -92,33 +86,31 @@ public class TypeItem extends GraphTargetItem{ public String toString() { return fullTypeName; } - - public int resolveClass(ABC abc){ + + public int resolveClass(ABC abc) { String name = fullTypeName; String pkg = ""; - if(name.contains(".")){ - pkg = name.substring(0,name.lastIndexOf('.')); - name = name.substring(name.lastIndexOf('.')+1); + if (name.contains(".")) { + pkg = name.substring(0, name.lastIndexOf('.')); + name = name.substring(name.lastIndexOf('.') + 1); } - for(InstanceInfo ii:abc.instance_info){ - Multiname mname=abc.constants.constant_multiname.get(ii.name_index); - if(mname.getName(abc.constants, new ArrayList()).equals(name)){ - if(mname.getNamespace(abc.constants).hasName(pkg,abc.constants)){ + for (InstanceInfo ii : abc.instance_info) { + Multiname mname = abc.constants.constant_multiname.get(ii.name_index); + if (mname.getName(abc.constants, new ArrayList()).equals(name)) { + if (mname.getNamespace(abc.constants).hasName(pkg, abc.constants)) { return ii.name_index; } } } - for(int i=1;i()))){ - if(pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants))){ + for (int i = 1; i < abc.constants.constant_multiname.size(); i++) { + Multiname mname = abc.constants.constant_multiname.get(i); + if (name.equals(mname.getName(abc.constants, new ArrayList()))) { + if (pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants))) { return i; } } } - return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0,true), 0,0, new ArrayList()), true); + return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList()), true); } - - - + } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/AndItem.java b/trunk/src/com/jpexs/decompiler/graph/model/AndItem.java index b95aede51..aa4b003f3 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/AndItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/AndItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -46,12 +47,12 @@ public class AndItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java index 2c8ffe995..781fe2d84 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BlockItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -46,7 +47,7 @@ public class BlockItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, commands); } @@ -54,9 +55,9 @@ public class BlockItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java index f334c79fc..c07287404 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/BreakItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -56,7 +57,7 @@ public class BreakItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -64,9 +65,9 @@ public class BreakItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java b/trunk/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java index ebb87c24d..dcab3ff7d 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -51,7 +52,7 @@ public class CommaExpressionItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -59,9 +60,9 @@ public class CommaExpressionItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { - return commands.isEmpty()?TypeItem.UNBOUNDED:commands.get(commands.size()-1).returnType(); - } + return commands.isEmpty() ? TypeItem.UNBOUNDED : commands.get(commands.size() - 1).returnType(); + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java b/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java index 53934eef2..b717b7554 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/CommentItem.java @@ -68,9 +68,9 @@ public class CommentItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java index 9ea76c608..823b78d1a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ContinueItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -56,7 +57,7 @@ public class ContinueItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -64,9 +65,9 @@ public class ContinueItem extends GraphTargetItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java index 7ade97552..733f3a37b 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/DoWhileItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -110,7 +111,7 @@ public class DoWhileItem extends LoopItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -118,9 +119,9 @@ public class DoWhileItem extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/DuplicateItem.java b/trunk/src/com/jpexs/decompiler/graph/model/DuplicateItem.java index 1b23550c3..89c120349 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/DuplicateItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/DuplicateItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -76,7 +77,7 @@ public class DuplicateItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -84,9 +85,9 @@ public class DuplicateItem extends GraphTargetItem { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java index 15a9a8833..b6c750ced 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ForItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -133,7 +134,7 @@ public class ForItem extends LoopItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -141,9 +142,9 @@ public class ForItem extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java index 586df72e1..bd6613f9a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/IfItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -147,7 +148,7 @@ public class IfItem extends GraphTargetItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -155,9 +156,9 @@ public class IfItem extends GraphTargetItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java b/trunk/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java index 87127bb87..a6965f386 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java @@ -54,9 +54,9 @@ public class IntegerValueItem extends GraphTargetItem { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/NotItem.java b/trunk/src/com/jpexs/decompiler/graph/model/NotItem.java index 7e4519d7b..20a3b296f 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/NotItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/NotItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.model.operations.Inverted; import com.jpexs.decompiler.flash.ecma.EcmaScript; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -67,7 +68,7 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -75,9 +76,9 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/OrItem.java b/trunk/src/com/jpexs/decompiler/graph/model/OrItem.java index fa410be26..ceb993fe1 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/OrItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/OrItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -41,7 +42,7 @@ public class OrItem extends BinaryOpItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -49,9 +50,9 @@ public class OrItem extends BinaryOpItem { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java index 12829e312..1316161bf 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -42,7 +43,7 @@ public class ParenthesisItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return value.toSource(localData, generator); } @@ -50,9 +51,9 @@ public class ParenthesisItem extends GraphTargetItem { public boolean hasReturnValue() { return value.hasReturnValue(); } - + @Override public GraphTargetItem returnType() { return value.returnType(); - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java b/trunk/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java index 2faa6ee6a..1ca9e3d92 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java @@ -49,9 +49,9 @@ public class ScriptEndItem extends GraphTargetItem implements ExitItem { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java index 7465d1b91..f8e7f631a 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/SwitchItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -142,7 +143,7 @@ public class SwitchItem extends LoopItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -150,9 +151,9 @@ public class SwitchItem extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/TernarOpItem.java b/trunk/src/com/jpexs/decompiler/graph/model/TernarOpItem.java index 762a9e8f5..72b691da2 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/TernarOpItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/TernarOpItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; @@ -47,7 +48,7 @@ public class TernarOpItem extends GraphTargetItem { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -55,9 +56,9 @@ public class TernarOpItem extends GraphTargetItem { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return onTrue.returnType(); - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/TrueItem.java b/trunk/src/com/jpexs/decompiler/graph/model/TrueItem.java index 057fd0e24..d2f71a87c 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/TrueItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/TrueItem.java @@ -40,9 +40,9 @@ public class TrueItem extends GraphTargetItem { public boolean hasReturnValue() { return true; } - + @Override public GraphTargetItem returnType() { return TypeItem.BOOLEAN; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/UnboundedTypeItem.java b/trunk/src/com/jpexs/decompiler/graph/model/UnboundedTypeItem.java index 28d32da84..fbc7adce8 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/UnboundedTypeItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/UnboundedTypeItem.java @@ -45,8 +45,6 @@ public class UnboundedTypeItem extends AVM2Item { public String toString() { return "*"; } - - @Override public boolean hasReturnValue() { diff --git a/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java b/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java index ab49cebee..de29c804d 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java @@ -98,8 +98,9 @@ public class UniversalLoopItem extends LoopItem implements Block { public boolean hasReturnValue() { return false; } + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java index 87aab30b4..66da324bd 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.LoopWithType; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.Block; +import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; @@ -107,7 +108,7 @@ public class WhileItem extends LoopItem implements Block { } @Override - public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) { + public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return generator.generate(localData, this); } @@ -115,9 +116,9 @@ public class WhileItem extends LoopItem implements Block { public boolean hasReturnValue() { return false; } - + @Override public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; - } + } }