diff --git a/CHANGELOG.md b/CHANGELOG.md index 78d1f7ace..291a5f2f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ All notable changes to this project will be documented in this file. - [#2446] Nightly version asked for update to previous stable - [#2447] SVG import - gradients can inherit (href) from other gradient types (radial vs linear) - [#2450] Morphshape replace button/menu is not working (throws exception due to missing icon) +- [#2355] AS1/2 Simplify expressions feature colliding with some other features like hex values ## [22.0.2] - 2025-01-17 ### Added @@ -3748,6 +3749,7 @@ Major version of SWF to XML export changed to 2. [#2446]: https://www.free-decompiler.com/flash/issues/2446 [#2447]: https://www.free-decompiler.com/flash/issues/2447 [#2450]: https://www.free-decompiler.com/flash/issues/2450 +[#2355]: https://www.free-decompiler.com/flash/issues/2355 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 761c9748b..378feacea 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -222,7 +222,7 @@ public class AVM2Graph extends Graph { * @param localRegAssignmentIps Local register assignment IPs */ public AVM2Graph(int swfVersion, AbcIndexing abcIndex, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, ScopeStack scopeStack, ScopeStack localScopeStack, HashMap localRegNames, List fullyQualifiedNames, HashMap localRegAssignmentIps) { - super(new AVM2GraphSource(code, isStatic, scriptIndex, classIndex, localRegs, abc, body, localRegNames, fullyQualifiedNames, localRegAssignmentIps), getExceptionEntries(body)); + super(AVM2GraphTargetDialect.INSTANCE, new AVM2GraphSource(code, isStatic, scriptIndex, classIndex, localRegs, abc, body, localRegNames, fullyQualifiedNames, localRegAssignmentIps), getExceptionEntries(body)); this.avm2code = code; this.abc = abc; this.body = body; @@ -2066,17 +2066,17 @@ public class AVM2Graph extends Graph { if (withCommands.size() > 1) { withCommands.remove(withCommands.size() - 1); withCommands.add(expr); - expr = new CommaExpressionItem(null, localData.lineStartInstruction, withCommands); + expr = new CommaExpressionItem(dialect, null, localData.lineStartInstruction, withCommands); } } else { //There is no if - this means there was something that // can be evaluated on compiletime and compiler removed the whole if // ASC2 does this - withCommands.add(new FalseItem(null, localData.lineStartInstruction)); - expr = new CommaExpressionItem(null, localData.lineStartInstruction, withCommands); + withCommands.add(new FalseItem(dialect, null, localData.lineStartInstruction)); + expr = new CommaExpressionItem(dialect, null, localData.lineStartInstruction, withCommands); } } else { - expr = new FalseItem(null, localData.lineStartInstruction); + expr = new FalseItem(dialect, null, localData.lineStartInstruction); } FilteredCheckAVM2Item filteredCheck = (FilteredCheckAVM2Item) hn.obj.getThroughRegister().getNotCoerced(); FilterAVM2Item filter = new FilterAVM2Item(null, null, filteredCheck.object, expr); @@ -2737,13 +2737,13 @@ public class AVM2Graph extends Graph { if (wi.expression == list && !list.isEmpty()) { GraphTargetItem lastExpr = list.remove(list.size() - 1); List onTrue = new ArrayList<>(); - BreakItem bi = new BreakItem(null, null, wi.loop.id); + BreakItem bi = new BreakItem(dialect, null, null, wi.loop.id); onTrue.add(bi); - IfItem ifi = new IfItem(null, null, lastExpr.invert(null), onTrue, new ArrayList<>()); + IfItem ifi = new IfItem(dialect, null, null, lastExpr.invert(null), onTrue, new ArrayList<>()); list.add(ifi); wi.commands.addAll(0, list); list.clear(); - list.add(new TrueItem(null, null)); + list.add(new TrueItem(dialect, null, null)); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphTargetDialect.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphTargetDialect.java new file mode 100644 index 000000000..8a7db4e3b --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphTargetDialect.java @@ -0,0 +1,88 @@ +package com.jpexs.decompiler.flash.abc.avm2.graph; + +import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair; +import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NewObjectAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.StringAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.UndefinedAVM2Item; +import com.jpexs.decompiler.flash.ecma.ArrayType; +import com.jpexs.decompiler.flash.ecma.Null; +import com.jpexs.decompiler.flash.ecma.ObjectType; +import com.jpexs.decompiler.flash.ecma.Undefined; +import com.jpexs.decompiler.graph.GraphTargetDialect; +import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.model.FalseItem; +import com.jpexs.decompiler.graph.model.TrueItem; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class AVM2GraphTargetDialect extends GraphTargetDialect { + + public static final GraphTargetDialect INSTANCE = new AVM2GraphTargetDialect(); + + private AVM2GraphTargetDialect() { + + } + + @Override + public String getName() { + return "AVM2"; + } + + @Override + public GraphTargetItem valToItem(Object r) { + if (r == null) { + return null; + } + if (r instanceof Boolean) { + if ((Boolean) r) { + return new TrueItem(this, null, null); + } else { + return new FalseItem(this, null, null); + } + } + if (r instanceof String) { + return new StringAVM2Item(null, null, (String) r); + } + if (r instanceof Long) { + return new DoubleValueAVM2Item(null, null, (double) (Long) r); + } + if (r instanceof Integer) { + return new IntegerValueAVM2Item(null, null, (Integer) r); + } + + if (r instanceof Double) { + return new DoubleValueAVM2Item(null, null, (Double) r); + } + if (r instanceof Null) { + return new NullAVM2Item(null, null); + } + if (r instanceof Undefined) { + return new UndefinedAVM2Item(null, null); + } + if (r instanceof ArrayType) { + List vals = new ArrayList<>(); + ArrayType at = (ArrayType) r; + for (Object v : at.values) { + vals.add(valToItem(v)); + } + return new NewArrayAVM2Item(null, null, vals); + } + if (r instanceof ObjectType) { + List props = new ArrayList<>(); + ObjectType ot = (ObjectType) r; + for (String k : ot.getAttributeNames()) { + props.add(new NameValuePair(valToItem(k), valToItem(ot.getAttribute(k)))); + } + return new NewObjectAVM2Item(null, null, props); + } + return null; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java index cee1c1e8f..5d7d352bb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/DupIns.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -53,7 +54,7 @@ public class DupIns extends InstructionDefinition { public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { GraphTargetItem v = stack.pop(); stack.push(v); - stack.push(new DuplicateItem(ins, localData.lineStartInstruction, v)); + stack.push(new DuplicateItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction, v)); //v.moreSrc.add(new GraphSourceItemPos(ins, 0)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java index 4858f530e..2a5ab7d9b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushFalseIns.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -49,7 +50,7 @@ public class PushFalseIns extends InstructionDefinition { @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { - stack.push(new FalseItem(ins, localData.lineStartInstruction)); + stack.push(new FalseItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java index a306e36bb..32fea9dfb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushTrueIns.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -49,7 +50,7 @@ public class PushTrueIns extends InstructionDefinition { @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { - stack.push(new TrueItem(ins, localData.lineStartInstruction)); + stack.push(new TrueItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction)); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java index 25e1874f4..94bedf34a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -68,7 +69,7 @@ public abstract class AVM2Item extends GraphTargetItem { * @param value Value */ public AVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, int precedence, GraphTargetItem value) { - super(instruction, lineStartIns, precedence, value); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, precedence, value); if (instruction instanceof AVM2Instruction) { this.instruction = (AVM2Instruction) instruction; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullCoalesceAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullCoalesceAVM2Item.java index 24671c4ce..e4fbe0125 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullCoalesceAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NullCoalesceAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -33,7 +34,7 @@ import java.util.List; public class NullCoalesceAVM2Item extends BinaryOpItem { public NullCoalesceAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartItem, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartItem, PRECEDENCE_NULLCOALESCE, leftSide, rightSide, "??", null, null); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartItem, PRECEDENCE_NULLCOALESCE, leftSide, rightSide, "??", null, null); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java index 23381458c..973b2ea93 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForEachInAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.clauses; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.model.InAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -88,7 +89,7 @@ public class ForEachInAVM2Item extends LoopItem implements Block { * @param commands Commands */ public ForEachInAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, InAVM2Item expression, List commands) { - super(instruction, lineStartIns, loop); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, loop); /* Following was commented out: diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java index 05691aa78..6e64dfb85 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/ForInAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.clauses; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.model.InAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -88,7 +89,7 @@ public class ForInAVM2Item extends LoopItem implements Block { * @param commands Commands */ public ForInAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, InAVM2Item expression, List commands) { - super(instruction, lineStartIns, loop); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, loop); //Commented out - see the comment in ForEachInAVM2Item /*if (!commands.isEmpty()) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java index ae4ee5d9b..812507d58 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -48,7 +49,7 @@ public class AddAVM2Item extends BinaryOpItem implements CompoundableBinaryOp { * @param rightSide Right side */ public AddAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+", "", ""); //? + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+", "", ""); //? } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java index b262f8b84..fcc8d7751 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -42,7 +43,7 @@ public class AsTypeAVM2Item extends BinaryOpItem { * @param type Type */ public AsTypeAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem type) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "as", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "as", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java index f15cd2712..7750ce0f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitNotAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; @@ -44,7 +45,7 @@ public class BitNotAVM2Item extends UnaryOpItem { * @param value Value */ public BitNotAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "~", "int"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, value, "~", "int"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitwiseBinaryOpAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitwiseBinaryOpAVM2Item.java index a38042250..b1bd15897 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitwiseBinaryOpAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitwiseBinaryOpAVM2Item.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -43,7 +44,7 @@ public abstract class BitwiseBinaryOpAVM2Item extends BinaryOpItem implements Co * @param coerceRight Coerce right */ public BitwiseBinaryOpAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator, String coerceLeft, String coerceRight) { - super(instruction, lineStartItem, precedence, leftSide, rightSide, operator, coerceLeft, coerceRight); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartItem, precedence, leftSide, rightSide, operator, coerceLeft, coerceRight); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java index 58778ce07..4d3c6b9a9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -47,7 +48,7 @@ public class DivideAVM2Item extends BinaryOpItem implements CompoundableBinaryOp * @param rightSide Right side */ public DivideAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java index 2f242046a..60935d441 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi * @param rightSide Right side */ public EqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "==", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "==", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index 25814800f..5bb69cc58 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi * @param rightSide Right side */ public GeAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">=", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">=", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index 87c7f2933..06b92d958 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi * @param rightSide Right side */ public GtAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java index 6ea80a422..b77b3a1c5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class InAVM2Item extends BinaryOpItem { * @param object Object */ public InAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem name, GraphTargetItem object) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, name, object, "in", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, name, object, "in", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java index 2dae1aa45..85fa3bbdc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class InstanceOfAVM2Item extends BinaryOpItem { * @param type Type */ public InstanceOfAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem type) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "instanceof", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "instanceof", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java index 25c4b8829..067c4b36a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class IsTypeAVM2Item extends BinaryOpItem { * @param type Type */ public IsTypeAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem type) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "is", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "is", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java index f8bce16a2..05adc5ad4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class LShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryOp * @param rightSide Right side */ public LShiftAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index 2ce5980b3..7bad17d69 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi * @param rightSide Right side */ public LeAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<=", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<=", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index 6b9bef9ff..b88557f88 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi * @param rightSide Right side */ public LtAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java index 41b0191bc..101f1469e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -46,7 +47,7 @@ public class ModuloAVM2Item extends BinaryOpItem implements CompoundableBinaryOp * @param rightSide Right side */ public ModuloAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java index aa16d2c2b..39e398eba 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -46,7 +47,7 @@ public class MultiplyAVM2Item extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public MultiplyAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java index e6b886027..a5a5e07fb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NegAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -41,7 +42,7 @@ public class NegAVM2Item extends UnaryOpItem { * @param value Value */ public NegAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "-", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, value, "-", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java index d489d3aca..2e5a7b47f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit * @param rightSide Right side */ public NeqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java index 852633007..36ca933ba 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreDecrementAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; 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; @@ -41,7 +42,7 @@ public class PreDecrementAVM2Item extends UnaryOpItem implements AssignmentAVM2I * @param object Object */ public PreDecrementAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, object, "--", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, object, "--", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java index 4d650be54..ae7cf0adc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/PreIncrementAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.parser.script.AssignableAVM2Item; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -40,7 +41,7 @@ public class PreIncrementAVM2Item extends UnaryOpItem { * @param object Object */ public PreIncrementAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, object, "++", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, object, "++", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java index e7074dafb..0b02f04a8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class RShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryOp * @param rightSide Right side */ public RShiftAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java index 3129ea5f3..7aa9a93c1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC * @param rightSide Right side */ public StrictEqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "===", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "===", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java index 59f986581..50d2b54fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -46,7 +47,7 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If * @param rightSide Right side */ public StrictNeqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java index a99b934d8..c10b6decc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -46,7 +47,7 @@ public class SubtractAVM2Item extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public SubtractAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java index b4c412ccb..d85f658f9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/TypeOfAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -45,7 +46,7 @@ public class TypeOfAVM2Item extends UnaryOpItem { * @param value Value */ public TypeOfAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "typeof ", ""); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, value, "typeof ", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java index 10306e28c..d1fea0436 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class URShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryO * @param rightSide Right side */ public URShiftAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>", "Number", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/UnPlusAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/UnPlusAVM2Item.java index bd1932bb7..8c49c3668 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/UnPlusAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/UnPlusAVM2Item.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.graph.CompilationException; @@ -41,7 +42,7 @@ public class UnPlusAVM2Item extends UnaryOpItem { * @param value Value */ public UnPlusAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "+", "Number"); + super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, value, "+", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 33ce23b87..4163af34d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; @@ -450,7 +451,7 @@ public class AVM2SourceGenerator implements SourceGenerator { AssignableAVM2Item.setTemp(localData, this, collectionReg) )); - GraphTargetItem assigned = new GraphTargetItem() { + GraphTargetItem assigned = new GraphTargetItem(AVM2GraphTargetDialect.INSTANCE) { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { return null; @@ -770,7 +771,7 @@ public class AVM2SourceGenerator implements SourceGenerator { */ List pairs = new ArrayList<>(); for (String tname : skinParts.keySet()) { - pairs.add(new NameValuePair(new StringAVM2Item(null, null, tname), skinParts.get(tname) ? new TrueItem(null, null) : new FalseItem(null, null))); + pairs.add(new NameValuePair(new StringAVM2Item(null, null, tname), skinParts.get(tname) ? new TrueItem(AVM2GraphTargetDialect.INSTANCE, null, null) : new FalseItem(AVM2GraphTargetDialect.INSTANCE, null, null))); } NewObjectAVM2Item sltVal = new NewObjectAVM2Item(null, null, pairs); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index fa8361abb..f58acc9df 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.NumberContext; +import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphTargetDialect; import com.jpexs.decompiler.flash.abc.avm2.model.ApplyTypeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; @@ -97,6 +98,7 @@ 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.DottedChain; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; import com.jpexs.decompiler.graph.TypeItem; @@ -147,6 +149,8 @@ import macromedia.asc.util.Decimal128; * @author JPEXS */ public class ActionScript3Parser { + + private static final GraphTargetDialect DIALECT = AVM2GraphTargetDialect.INSTANCE; private long uniqLast = 0; @@ -1661,7 +1665,7 @@ public class ActionScript3Parser { } break; case CURLY_OPEN: - ret = new BlockItem(null, null, commands(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables, abc)); + ret = new BlockItem(DIALECT, null, null, commands(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, variables, abc)); expectedType(SymbolType.CURLY_CLOSE); break; /*case INCREMENT: //preincrement @@ -1701,7 +1705,7 @@ public class ActionScript3Parser { } else { lexer.pushback(s); } - ret = new IfItem(null, null, ifExpr, onTrueList, onFalseList); + ret = new IfItem(DIALECT, null, null, ifExpr, onTrueList, onFalseList); break; case WHILE: expectedType(SymbolType.PARENT_OPEN); @@ -1715,7 +1719,7 @@ public class ActionScript3Parser { } loops.push(wloop); whileBody.add(command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables, abc)); - ret = new WhileItem(null, null, wloop, whileExpr, whileBody); + ret = new WhileItem(DIALECT, null, null, wloop, whileExpr, whileBody); loops.pop(); break; case DO: @@ -1731,7 +1735,7 @@ public class ActionScript3Parser { List doExpr = new ArrayList<>(); doExpr.add(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc)); expectedType(SymbolType.PARENT_CLOSE); - ret = new DoWhileItem(null, null, dloop, doBody, doExpr); + ret = new DoWhileItem(DIALECT, null, null, dloop, doBody, doExpr); loops.pop(); break; case FOR: @@ -1777,7 +1781,7 @@ public class ActionScript3Parser { //GraphTargetItem firstCommand = command(thisType,pkg,needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables); forExpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false, abc); if (forExpr == null) { - forExpr = new TrueItem(null, null); + forExpr = new TrueItem(DIALECT, null, null); } expectedType(SymbolType.SEMICOLON); GraphTargetItem fcom = command(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, loops, loopLabels, registerVars, inFunction, inMethod, forinlevel, true, variables, abc); @@ -1796,7 +1800,7 @@ public class ActionScript3Parser { ret = new ForInAVM2Item(null, null, floop, inexpr, forBody); } } else { - ret = new ForItem(null, null, floop, forFirstCommands, forExpr, forFinalCommands, forBody); + ret = new ForItem(DIALECT, null, null, floop, forFirstCommands, forExpr, forFinalCommands, forBody); } loops.pop(); break; @@ -1827,7 +1831,7 @@ public class ActionScript3Parser { int pos = 0; while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) { while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) { - GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem() : expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc); + GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem(DIALECT) : expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc); expectedType(SymbolType.COLON); s = lex(); caseExprsAll.add(curCaseExpr); @@ -1840,7 +1844,7 @@ public class ActionScript3Parser { s = lex(); } expected(s, lexer.yyline(), SymbolType.CURLY_CLOSE); - ret = new SwitchItem(null, null, sloop, switchExpr, caseExprsAll, caseCmds, valueMapping); + ret = new SwitchItem(DIALECT, null, null, sloop, switchExpr, caseExprsAll, caseCmds, valueMapping); loops.pop(); break; case BREAK: @@ -1864,7 +1868,7 @@ public class ActionScript3Parser { lexer.pushback(s); bloopId = loops.peek().id; } - ret = new BreakItem(null, null, bloopId); + ret = new BreakItem(DIALECT, null, null, bloopId); break; case CONTINUE: s = lex(); @@ -1899,7 +1903,7 @@ public class ActionScript3Parser { } } //TODO: handle switch - ret = new ContinueItem(null, null, cloopId); + ret = new ContinueItem(DIALECT, null, null, cloopId); break; case RETURN: GraphTargetItem retexpr = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, true, registerVars, inFunction, inMethod, true, variables, false, abc); @@ -2011,7 +2015,7 @@ public class ActionScript3Parser { break; } if (s.type == SymbolType.SEMICOLON) { - return new EmptyCommand(); + return new EmptyCommand(DIALECT); } lexer.pushback(s); ret = expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc); @@ -2114,7 +2118,7 @@ public class ActionScript3Parser { if (commaItems.size() == 1) { return commaItems.get(0); } - return new CommaExpressionItem(null, null, commaItems); + return new CommaExpressionItem(DIALECT, null, null, commaItems); } /** @@ -2219,7 +2223,7 @@ public class ActionScript3Parser { break; case TERNAR: //??? - lhs = new TernarOpItem(null, null, lhs, mhs, rhs); + lhs = new TernarOpItem(DIALECT, null, null, lhs, mhs, rhs); break; case SHIFT_LEFT: lhs = new LShiftAVM2Item(null, null, lhs, rhs); @@ -2267,10 +2271,10 @@ public class ActionScript3Parser { lhs = new GeAVM2Item(null, null, lhs, rhs); break; case AND: - lhs = new AndItem(null, null, lhs, rhs); + lhs = new AndItem(DIALECT, null, null, lhs, rhs); break; case OR: - lhs = new OrItem(null, null, lhs, rhs); + lhs = new OrItem(DIALECT, null, null, lhs, rhs); break; case MINUS: lhs = new SubtractAVM2Item(null, null, lhs, rhs); @@ -2344,10 +2348,10 @@ public class ActionScript3Parser { assigned = new BitXorAVM2Item(null, null, lhs, assigned); break; case ASSIGN_AND: - assigned = new AndItem(null, null, lhs, assigned); + assigned = new AndItem(DIALECT, null, null, lhs, assigned); break; case ASSIGN_OR: - assigned = new OrItem(null, null, lhs, assigned); + assigned = new OrItem(DIALECT, null, null, lhs, assigned); break; case ASSIGN: default: @@ -2422,13 +2426,13 @@ public class ActionScript3Parser { break; //Both ASs case "dup": - ret = new DuplicateItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false, abc)); + ret = new DuplicateItem(DIALECT, null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false, abc)); break; case "push": ret = new PushItem(expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, false, abc)); break; case "pop": - ret = new PopItem(null, null); + ret = new PopItem(DIALECT, null, null); break; case "goto": //TODO case "multiname": @@ -2634,11 +2638,11 @@ public class ActionScript3Parser { break; case NOT: - ret = new NotItem(null, null, expressionPrimary(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, false, variables, abc)); + ret = new NotItem(DIALECT, null, null, expressionPrimary(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, false, variables, abc)); break; case PARENT_OPEN: - ret = new ParenthesisItem(null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc)); + ret = new ParenthesisItem(DIALECT, null, null, expression(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, true, variables, true, abc)); expectedType(SymbolType.PARENT_CLOSE); if (ret.value == null) { throw new AVM2ParseException("Expression in parenthesis expected", lexer.yyline()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java index 5cf37a1f6..8c1aca15b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AssignableAVM2Item.java @@ -51,7 +51,7 @@ public abstract class AssignableAVM2Item extends AVM2Item { protected GraphTargetItem makeCoerced(GraphTargetItem assignedValue, GraphTargetItem targetType) { if (assignedValue instanceof OrItem) { OrItem oi = (OrItem) assignedValue; - return new OrItem(assignedValue.getSrc(), assignedValue.getLineStartItem(), makeCoerced(oi.leftSide, targetType), makeCoerced(oi.rightSide, targetType)); + return new OrItem(dialect, assignedValue.getSrc(), assignedValue.getLineStartItem(), makeCoerced(oi.leftSide, targetType), makeCoerced(oi.rightSide, targetType)); } //TODO: Is it needed for AndItem too? return new CoerceAVM2Item(null, null, assignedValue, targetType); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index 4685404a8..f2cb76e1e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -1241,7 +1241,7 @@ public abstract class Action implements GraphSourceItem { break; } if (ip >= actions.size()) { - output.add(new ScriptEndItem()); + output.add(new ScriptEndItem(ActionGraphTargetDialect.INSTANCE)); break; } if (Configuration.simplifyExpressions.get()) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java index e998b13dd..d7da444b6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -123,7 +123,7 @@ public class ActionGraph extends Graph { * @param charset Charset */ public ActionGraph(Map> uninitializedClassTraits, String path, boolean insideDoInitAction, boolean insideFunction, List code, HashMap registerNames, HashMap variables, HashMap functions, int version, String charset) { - super(new ActionGraphSource(path, insideDoInitAction, code, version, registerNames, variables, functions, charset), new ArrayList<>()); + super(ActionGraphTargetDialect.INSTANCE, new ActionGraphSource(path, insideDoInitAction, code, version, registerNames, variables, functions, charset), new ArrayList<>()); this.uninitializedClassTraits = uninitializedClassTraits; this.insideDoInitAction = insideDoInitAction; this.insideFunction = insideFunction; @@ -506,7 +506,7 @@ public class ActionGraph extends Graph { checkedBody.remove(0); if (checkedLoop == null) { checkedLoop = new Loop(localData.loops.size(), null, null); - checkedBody.add(new BreakItem(null, null, checkedLoop.id)); + checkedBody.add(new BreakItem(dialect, null, null, checkedLoop.id)); } sti.setValue(new DirectValueActionItem(Null.INSTANCE)); list.add(t, new ForInActionItem(null, null, checkedLoop, (GraphTargetItem) sti, enumerateItem.object, checkedBody)); @@ -524,7 +524,7 @@ public class ActionGraph extends Graph { list.remove(t); if (checkedLoop == null) { checkedLoop = new Loop(localData.loops.size(), null, null); - checkedBody.add(new BreakItem(null, null, checkedLoop.id)); + checkedBody.add(new BreakItem(dialect, null, null, checkedLoop.id)); } list.remove(t - 1); t--; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphTargetDialect.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphTargetDialect.java new file mode 100644 index 000000000..1ee98fd67 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraphTargetDialect.java @@ -0,0 +1,90 @@ +package com.jpexs.decompiler.flash.action; + +import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; +import com.jpexs.decompiler.flash.action.model.InitArrayActionItem; +import com.jpexs.decompiler.flash.action.model.InitObjectActionItem; +import com.jpexs.decompiler.flash.ecma.ArrayType; +import com.jpexs.decompiler.flash.ecma.Null; +import com.jpexs.decompiler.flash.ecma.ObjectType; +import com.jpexs.decompiler.flash.ecma.Undefined; +import com.jpexs.decompiler.graph.GraphTargetDialect; +import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.model.FalseItem; +import com.jpexs.decompiler.graph.model.TrueItem; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author JPEXS + */ +public class ActionGraphTargetDialect extends GraphTargetDialect { + + public static final GraphTargetDialect INSTANCE = new ActionGraphTargetDialect(); + + private ActionGraphTargetDialect() { + + } + + @Override + public String getName() { + return "Action"; + } + + @Override + public GraphTargetItem valToItem(Object r) { + if (r == null) { + return null; + } + if (r instanceof Boolean) { + if ((Boolean) r) { + return new TrueItem(this, null, null); + } else { + return new FalseItem(this, null, null); + } + } + if (r instanceof String) { + return new DirectValueActionItem((String) r); + } + if (r instanceof Long) { + return new DirectValueActionItem((Long) r); + } + if (r instanceof Integer) { + return new DirectValueActionItem((Long)(long)(Integer) r); + } + if (r instanceof Short) { + return new DirectValueActionItem((Long)(long)(Short) r); + } + if (r instanceof Byte) { + return new DirectValueActionItem((Long)(long)(Byte) r); + } + if (r instanceof Double) { + return new DirectValueActionItem((Double) r); + } + if (r instanceof Null) { + return new DirectValueActionItem(Null.INSTANCE); + } + if (r instanceof Undefined) { + return new DirectValueActionItem(Undefined.INSTANCE); + } + if (r instanceof ArrayType) { + List vals = new ArrayList<>(); + ArrayType at = (ArrayType) r; + for (Object v : at.values) { + vals.add(valToItem(v)); + } + return new InitArrayActionItem(null, null, vals); + } + if (r instanceof ObjectType) { + List names = new ArrayList<>(); + List vals = new ArrayList<>(); + ObjectType ot = (ObjectType) r; + for (String k : ot.getAttributeNames()) { + names.add(valToItem(k)); + vals.add(valToItem(ot.getAttribute(k))); + } + return new InitObjectActionItem(null, null, names, vals); + } + return null; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/ActionScript2ClassDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/ActionScript2ClassDetector.java index 5fd42edb9..892d97a3a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/ActionScript2ClassDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/ActionScript2ClassDetector.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.as2; import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CallFunctionActionItem; import com.jpexs.decompiler.flash.action.model.CallMethodActionItem; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; @@ -873,7 +874,7 @@ public class ActionScript2ClassDetector { } else { onFalse.add(ter.onFalse); } - commands.set(i, new IfItem(null, null, ter.expression, onTrue, onFalse)); + commands.set(i, new IfItem(ActionGraphTargetDialect.INSTANCE, null, null, ter.expression, onTrue, onFalse)); } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ActionItem.java index 3d50a57d2..e5e05e36c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/ActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionPop; import com.jpexs.decompiler.flash.action.swf4.ActionPush; @@ -42,7 +43,7 @@ public abstract class ActionItem extends GraphTargetItem implements Serializable * Constructor. */ public ActionItem() { - super(null, null, NOPRECEDENCE); + super(ActionGraphTargetDialect.INSTANCE, null, null, NOPRECEDENCE); } /** @@ -65,7 +66,7 @@ public abstract class ActionItem extends GraphTargetItem implements Serializable * @param value Value */ public ActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, int precedence, GraphTargetItem value) { - super(instruction, lineStartIns, precedence, value); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, precedence, value); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java index 87fc724a3..8f5c0bc2c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.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.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf4.ActionAdd; import com.jpexs.decompiler.flash.action.swf5.ActionAdd2; @@ -56,7 +57,7 @@ public class AddActionItem extends BinaryOpItem implements CompoundableBinaryOpA * @param version2 Version 2 */ public AddActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide, boolean version2) { - super(instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+", "", ""); this.version2 = version2; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java index 18e9d9bef..e80f8701a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionAnd; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class AndActionItem extends BinaryOpItem { * @param rightSide Right side */ public AndActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "and", "Boolean", "Boolean"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "and", "Boolean", "Boolean"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitwiseBinaryOpActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitwiseBinaryOpActionItem.java index 28da3ca74..bade394da 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitwiseBinaryOpActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitwiseBinaryOpActionItem.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.action.model.operations; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -43,7 +44,7 @@ public abstract class BitwiseBinaryOpActionItem extends BinaryOpItem implements * @param coerceRight Coerce right */ public BitwiseBinaryOpActionItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator, String coerceLeft, String coerceRight) { - super(instruction, lineStartItem, precedence, leftSide, rightSide, operator, coerceLeft, coerceRight); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartItem, precedence, leftSide, rightSide, operator, coerceLeft, coerceRight); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java index ad5e193ec..5307f3b36 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf4.ActionDivide; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class DivideActionItem extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public DivideActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/", "Number", "Number"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java index 6099a86ce..7440a366f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.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.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -52,7 +53,7 @@ public class EqActionItem extends BinaryOpItem implements LogicalOpItem, EqualsT * @param version2 Version 2 flag */ public EqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide, boolean version2) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "==", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "==", "", ""); this.version2 = version2; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java index 33aadf96d..15d9e0e40 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.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.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf4.ActionNot; @@ -55,7 +56,7 @@ public class GeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte * @param version2 Version 2 flag */ public GeActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide, boolean version2) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">=", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">=", "", ""); this.version2 = version2; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java index 22f53408a..c128ae6c7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; @@ -48,7 +49,7 @@ public class GtActionItem extends BinaryOpItem implements LogicalOpItem { * @param rightSide Right side */ public GtActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java index 2552cbd54..7d7446234 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.action.model.operations; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.ActionItem; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; @@ -41,7 +42,7 @@ public class InActionItem extends BinaryOpItem { * @param object Object */ public InActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, ActionItem name, ActionItem object) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, name, object, "in", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, name, object, "in", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java index 66e46d640..cb044bd16 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf6.ActionInstanceOf; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -43,7 +44,7 @@ public class InstanceOfActionItem extends BinaryOpItem { * @param type Type */ public InstanceOfActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value, GraphTargetItem type) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "instanceof", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, value, type, "instanceof", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java index 7fbe4c489..1be320404 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf5.ActionBitLShift; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -44,7 +45,7 @@ public class LShiftActionItem extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public LShiftActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<", "int", "int"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<", "int", "int"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java index 96b3021b1..6aa147170 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf4.ActionNot; @@ -49,7 +50,7 @@ public class LeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte * @param rightSide Right side */ public LeActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<=", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<=", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java index 4b7a13fb8..359cd3617 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.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.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; @@ -55,7 +56,7 @@ public class LtActionItem extends BinaryOpItem implements LogicalOpItem { * @param version2 Version 2 flag */ public LtActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide, boolean version2) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<", "", ""); this.version2 = version2; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java index d4d6f6ed4..9491943d7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf5.ActionModulo; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class ModuloActionItem extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public ModuloActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%", "Number", "Number"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java index aac1ed8a2..5b8173583 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf4.ActionMultiply; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class MultiplyActionItem extends BinaryOpItem implements CompoundableBina * @param rightSide Right side */ public MultiplyActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*", "Number", "Number"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java index 91b67ce71..69d40646f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.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.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -54,7 +55,7 @@ public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Invert * @param version2 Version 2 flag */ public NeqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide, boolean version2) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=", "", ""); this.version2 = version2; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java index ad30c5dca..afbcaa17c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionOr; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class OrActionItem extends BinaryOpItem { * @param rightSide Right side */ public OrActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "or", "Boolean", "Boolean"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "or", "Boolean", "Boolean"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java index ddb3b2cbe..6dd4a8cb2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreDecrementActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.model.GetMemberActionItem; import com.jpexs.decompiler.flash.action.model.GetPropertyActionItem; @@ -52,7 +53,7 @@ public class PreDecrementActionItem extends UnaryOpItem { * @param object Object */ public PreDecrementActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, object, "--", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, object, "--", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java index a20e71399..bcefd267c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/PreIncrementActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.model.GetMemberActionItem; import com.jpexs.decompiler.flash.action.model.GetPropertyActionItem; @@ -53,7 +54,7 @@ public class PreIncrementActionItem extends UnaryOpItem { * @param object Object */ public PreIncrementActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, object, "++", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_UNARY, object, "++", "" /*"Number" Causes unnecessary ++Number(xx) when xx not number*/); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java index d793f3b41..c9808c8fd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf5.ActionBitRShift; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -44,7 +45,7 @@ public class RShiftActionItem extends BinaryOpItem implements CompoundableBinary * @param rightSide Right side */ public RShiftActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>", "int", "int"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>", "int", "int"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java index 300f462cd..4acd9bc20 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf6.ActionStrictEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -45,7 +46,7 @@ public class StrictEqActionItem extends BinaryOpItem implements LogicalOpItem, I * @param rightSide Right side */ public StrictEqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "===", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "===", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java index 3b4e4c89b..2923240ba 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf6.ActionStrictEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -47,7 +48,7 @@ public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem, * @param rightSide Right side */ public StrictNeqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java index 8ad076e36..bf7cdb4b2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionStringAdd; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class StringAddActionItem extends BinaryOpItem { * @param rightSide Right side */ public StringAddActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "add", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "add", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java index bf1a50acd..933403656 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionStringEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class StringEqActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringEqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "eq", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "eq", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java index b1075f09b..b848e3d73 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -45,7 +46,7 @@ public class StringGeActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringGeActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "ge", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "ge", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java index 30311e91b..b72321cbc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; import com.jpexs.decompiler.flash.action.swf6.ActionStringGreater; @@ -46,7 +47,7 @@ public class StringGtActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringGtActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "gt", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "gt", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java index b454a5136..5efd0765d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; @@ -47,7 +48,7 @@ public class StringLeActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringLeActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "le", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "le", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java index 85b35668c..e86307b30 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class StringLtActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringLtActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "lt", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_RELATIONAL, leftSide, rightSide, "lt", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java index a02f1858e..3e21ec8cb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf4.ActionStringEquals; import com.jpexs.decompiler.graph.CompilationException; @@ -44,7 +45,7 @@ public class StringNeActionItem extends BinaryOpItem implements Inverted { * @param rightSide Right side */ public StringNeActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "ne", "String", "String"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "ne", "String", "String"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java index c9c1f423b..f7f268afb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.swf4.ActionSubtract; @@ -47,7 +48,7 @@ public class SubtractActionItem extends BinaryOpItem implements CompoundableBina * @param rightSide Right side */ public SubtractActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-", "Number", "Number"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java index d0fc1feb5..0183e9447 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.CompoundableBinaryOpAs12; import com.jpexs.decompiler.flash.action.swf5.ActionBitURShift; import com.jpexs.decompiler.graph.CompilationException; @@ -43,7 +44,7 @@ public class URShiftActionItem extends BinaryOpItem implements CompoundableBinar * @param rightSide Right side */ public URShiftActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>", "Number", "Number"); + super(ActionGraphTargetDialect.INSTANCE, instruction, lineStartIns, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>", "Number", "Number"); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index 12400209e..35a27f783 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.parser.script; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.model.AsciiToCharActionItem; import com.jpexs.decompiler.flash.action.model.CallActionItem; import com.jpexs.decompiler.flash.action.model.CallFunctionActionItem; @@ -141,6 +142,7 @@ import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD; import com.jpexs.decompiler.flash.types.CLIPEVENTFLAGS; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.AndItem; @@ -181,6 +183,8 @@ import java.util.Map; */ public class ActionScript2Parser { + private static final GraphTargetDialect DIALECT = ActionGraphTargetDialect.INSTANCE; + /** * Builtin classes that can be casted to */ @@ -1145,7 +1149,7 @@ public class ActionScript2Parser { } break; case CURLY_OPEN: - ret = new BlockItem(null, null, commands(inFunction, inMethod, forinlevel, inTellTarget, variables, functions, hasEval)); + ret = new BlockItem(DIALECT, null, null, commands(inFunction, inMethod, forinlevel, inTellTarget, variables, functions, hasEval)); expectedType(SymbolType.CURLY_CLOSE); break; case INCREMENT: //preincrement @@ -1184,7 +1188,7 @@ public class ActionScript2Parser { } else { lexer.pushback(s); } - ret = new IfItem(null, null, ifExpr, onTrueList, onFalseList); + ret = new IfItem(DIALECT, null, null, ifExpr, onTrueList, onFalseList); break; case WHILE: expectedType(SymbolType.PARENT_OPEN); @@ -1193,7 +1197,7 @@ public class ActionScript2Parser { expectedType(SymbolType.PARENT_CLOSE); List whileBody = new ArrayList<>(); whileBody.add(command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval)); - ret = new WhileItem(null, null, null, whileExpr, whileBody); + ret = new WhileItem(DIALECT, null, null, null, whileExpr, whileBody); break; case DO: List doBody = new ArrayList<>(); @@ -1203,7 +1207,7 @@ public class ActionScript2Parser { List doExpr = new ArrayList<>(); doExpr.add(expression(inFunction, inMethod, inTellTarget, true, variables, functions, true, hasEval)); expectedType(SymbolType.PARENT_CLOSE); - ret = new DoWhileItem(null, null, null, doBody, doExpr); + ret = new DoWhileItem(DIALECT, null, null, null, doBody, doExpr); break; case FOR: expectedType(SymbolType.PARENT_OPEN); @@ -1240,7 +1244,7 @@ public class ActionScript2Parser { item = new VariableActionItem(objIdent, null, define); - item.setStoreValue(new GraphTargetItem() { + item.setStoreValue(new GraphTargetItem(DIALECT) { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { @@ -1290,7 +1294,7 @@ public class ActionScript2Parser { } forExpr = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); if (forExpr == null) { - forExpr = new TrueItem(null, null); + forExpr = new TrueItem(DIALECT, null, null); } expectedType(SymbolType.SEMICOLON); GraphTargetItem fcom = command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval); @@ -1304,7 +1308,7 @@ public class ActionScript2Parser { if (forin) { ret = new ForInActionItem(null, null, null, item, collection, forBody); } else { - ret = new ForItem(null, null, null, forFirstCommands, forExpr, forFinalCommands, forBody); + ret = new ForItem(DIALECT, null, null, null, forFirstCommands, forExpr, forFinalCommands, forBody); } break; case SWITCH: @@ -1330,7 +1334,7 @@ public class ActionScript2Parser { while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) { //List caseExprs; = new ArrayList<>(); while (s.type == SymbolType.CASE || s.type == SymbolType.DEFAULT) { - GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem() : expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); + GraphTargetItem curCaseExpr = s.type == SymbolType.DEFAULT ? new DefaultItem(DIALECT) : expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); //caseExprs.add(curCaseExpr); expectedType(SymbolType.COLON); s = lex(); @@ -1344,13 +1348,13 @@ public class ActionScript2Parser { s = lex(); } expected(s, lexer.yyline(), SymbolType.CURLY_CLOSE); - ret = new SwitchItem(null, null, null, switchExpr, caseExprsAll, caseCmds, valueMapping); + ret = new SwitchItem(DIALECT, null, null, null, switchExpr, caseExprsAll, caseCmds, valueMapping); break; case BREAK: - ret = new BreakItem(null, null, 0); //? There is no more than 1 level continue/break in AS1/2 + ret = new BreakItem(DIALECT, null, null, 0); //? There is no more than 1 level continue/break in AS1/2 break; case CONTINUE: - ret = new ContinueItem(null, null, 0); //? There is no more than 1 level continue/break in AS1/2 + ret = new ContinueItem(DIALECT, null, null, 0); //? There is no more than 1 level continue/break in AS1/2 break; case RETURN: GraphTargetItem retexpr = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); @@ -1407,7 +1411,7 @@ public class ActionScript2Parser { if (debugMode) { System.out.println("/command"); } - return new EmptyCommand(); + return new EmptyCommand(DIALECT); case DIRECTIVE: switch ((String) s.value) { case "strict": @@ -1462,7 +1466,7 @@ public class ActionScript2Parser { if (commaItems.size() == 1) { return commaItems.get(0); } - return new CommaExpressionItem(null, null, commaItems); + return new CommaExpressionItem(DIALECT, null, null, commaItems); } private ParsedSymbol peekLex() throws IOException, ActionParseException, InterruptedException { @@ -1541,7 +1545,7 @@ public class ActionScript2Parser { switch (op.type) { case TERNAR: - lhs = new TernarOpItem(null, null, lhs, mhs, rhs); + lhs = new TernarOpItem(DIALECT, null, null, lhs, mhs, rhs); break; case SHIFT_LEFT: lhs = new LShiftActionItem(null, null, lhs, rhs); @@ -1589,10 +1593,10 @@ public class ActionScript2Parser { lhs = new GeActionItem(null, null, lhs, rhs, true/*FIXME SWF version?*/); break; case AND: - lhs = new AndItem(null, null, lhs, rhs); + lhs = new AndItem(DIALECT, null, null, lhs, rhs); break; case OR: - lhs = new OrItem(null, null, lhs, rhs); + lhs = new OrItem(DIALECT, null, null, lhs, rhs); break; case FULLAND: lhs = new AndActionItem(null, null, lhs, rhs); @@ -1752,7 +1756,7 @@ public class ActionScript2Parser { private GraphTargetItem handleVariable(ParsedSymbol s, GraphTargetItem ret, List variables, Reference allowMemberOrCall, boolean inFunction, boolean inMethod, boolean inTellTarget, List functions, Reference hasEval) throws IOException, ActionParseException, InterruptedException { if (s.value.equals("not")) { - ret = new NotItem(null, null, expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval)); + ret = new NotItem(DIALECT, null, null, expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval)); } else { String varName = s.value.toString(); /*if (s.type == SymbolType.PATH) { //only with slash syntax @@ -1797,13 +1801,13 @@ public class ActionScript2Parser { break; //Both ASs case "dup": - ret = new DuplicateItem(null, null, expression(inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, false, hasEval)); + ret = new DuplicateItem(DIALECT, null, null, expression(inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, false, hasEval)); break; case "push": ret = new PushItem(expression(inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, false, hasEval)); break; case "pop": - ret = new PopItem(null, null); + ret = new PopItem(DIALECT, null, null); break; case "strict": s = lexer.lex(); @@ -1953,7 +1957,7 @@ public class ActionScript2Parser { break; case NOT: - ret = new NotItem(null, null, expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval)); + ret = new NotItem(DIALECT, null, null, expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval)); break; case PARENT_OPEN: @@ -1961,7 +1965,7 @@ public class ActionScript2Parser { if (pexpr == null) { throw new ActionParseException("Expression expected", lexer.yyline()); } - ret = new ParenthesisItem(null, null, pexpr); + ret = new ParenthesisItem(DIALECT, null, null, pexpr); expectedType(SymbolType.PARENT_CLOSE); allowMemberOrCall = true; break; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 51cb95597..cf47bf86a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.EndOfStreamException; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.ActionList; import com.jpexs.decompiler.flash.action.LocalDataArea; import com.jpexs.decompiler.flash.action.as2.Trait; @@ -501,9 +502,9 @@ public class ActionPush extends Action { if (o instanceof Boolean) { Boolean b = (Boolean) o; if (b) { - toPush = new TrueItem(this, lineStartAction); + toPush = new TrueItem(ActionGraphTargetDialect.INSTANCE, this, lineStartAction); } else { - toPush = new FalseItem(this, lineStartAction); + toPush = new FalseItem(ActionGraphTargetDialect.INSTANCE, this, lineStartAction); } } else { DirectValueActionItem dvt = new DirectValueActionItem(this, lineStartAction, pos, o, constantPool); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java index 6e26c6473..d76471d8e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.BaseLocalData; import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.action.ActionGraphTargetDialect; import com.jpexs.decompiler.flash.action.LocalDataArea; import com.jpexs.decompiler.flash.action.as2.Trait; import com.jpexs.decompiler.flash.types.annotations.SWFVersion; @@ -65,7 +66,7 @@ public class ActionPushDuplicate extends Action { @Override public void translate(Map> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartAction, TranslateStack stack, List output, HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { GraphTargetItem value = stack.peek(); - stack.push(new DuplicateItem(this, lineStartAction, value)); + stack.push(new DuplicateItem(ActionGraphTargetDialect.INSTANCE, this, lineStartAction, value)); value.getMoreSrc().add(new GraphSourceItemPos(this, 0)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index ac6e923cb..6765d3c8e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -86,6 +86,11 @@ public class Graph { * Graph entry points */ public List heads; + + /** + * Graph target dialect + */ + protected GraphTargetDialect dialect; /** * Graph source code @@ -144,10 +149,12 @@ public class Graph { /** * Constructs a new Graph. * + * @param dialect Dialect * @param code Graph source * @param exceptions Exceptions in the graph */ - public Graph(GraphSource code, List exceptions) { + public Graph(GraphTargetDialect dialect, GraphSource code, List exceptions) { + this.dialect = dialect; this.code = code; this.exceptions = exceptions; } @@ -1165,7 +1172,7 @@ public class Graph { ContinueItem cnt = (ContinueItem) commands.get(commands.size() - 1); if (cnt.loopId == lastLoopId) { hasContinues = true; - commands.set(commands.size() - 1, new BreakItem(null, null, swi.loop.id)); + commands.set(commands.size() - 1, new BreakItem(dialect, null, null, swi.loop.id)); if (c == swi.caseCommands.size() - 1) { if (commands.size() == 1) { commands.remove(0); @@ -1187,7 +1194,7 @@ public class Graph { } targetCommands.addAll(toAdd); if (toAdd.isEmpty() || (!((toAdd.get(toAdd.size() - 1) instanceof ExitItem) || (toAdd.get(toAdd.size() - 1) instanceof BreakItem)))) { - targetCommands.add(new BreakItem(null, null, swi.loop.id)); + targetCommands.add(new BreakItem(dialect, null, null, swi.loop.id)); } } } else if (item instanceof IfItem) { @@ -1501,7 +1508,7 @@ public class Graph { } else { GraphTargetItem lastExpr = whi.expression.remove(whi.expression.size() - 1); forFirstCommands.addAll(whi.expression); - list.set(i, new ForItem(whi.getSrc(), whi.getLineStartItem(), whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands)); + list.set(i, new ForItem(dialect, whi.getSrc(), whi.getLineStartItem(), whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands)); } } } @@ -1526,7 +1533,7 @@ public class Graph { if (gi.targetCommands != null) { list.remove(gi); if (gi.labelName != null) { - list.add(new LabelItem(null, gi.lineStartItem, gi.labelName)); + list.add(new LabelItem(dialect, null, gi.lineStartItem, gi.labelName)); } list.addAll(gi.targetCommands); } @@ -2043,10 +2050,10 @@ public class Graph { continue; } if (l.loopContinue == part) { - return (new ContinueItem(null, firstIns, l.id)); + return (new ContinueItem(dialect, null, firstIns, l.id)); } if (l.loopBreak == part) { - return (new BreakItem(null, firstIns, l.id)); + return (new BreakItem(dialect, null, firstIns, l.id)); } } return null; @@ -2840,7 +2847,7 @@ public class Graph { if (debugPrintGraph) { System.err.println("Adding break"); } - ret.add(new BreakItem(null, localData.lineStartInstruction, el.id)); + ret.add(new BreakItem(dialect, null, localData.lineStartInstruction, el.id)); return ret; } if (el.loopPreContinue == part) { @@ -2850,7 +2857,7 @@ public class Graph { if (debugPrintGraph) { System.err.println("Adding precontinue"); } - ret.add(new ContinueItem(null, localData.lineStartInstruction, el.id)); + ret.add(new ContinueItem(dialect, null, localData.lineStartInstruction, el.id)); return ret; } if (el.loopContinue == part) { @@ -2860,7 +2867,7 @@ public class Graph { if (debugPrintGraph) { System.err.println("Adding continue"); } - ret.add(new ContinueItem(null, localData.lineStartInstruction, el.id)); + ret.add(new ContinueItem(dialect, null, localData.lineStartInstruction, el.id)); return ret; } } @@ -2899,7 +2906,7 @@ public class Graph { } if (code.size() <= part.start) { - ret.add(new ScriptEndItem()); + ret.add(new ScriptEndItem(dialect)); return ret; } @@ -2925,9 +2932,9 @@ public class Graph { if (firstCode.size() > firstCodePos && (firstCode.get(firstCodePos) instanceof LabelItem)) { labelName = ((LabelItem) firstCode.get(firstCodePos)).labelName; } else { - firstCode.add(firstCodePos, new LabelItem(null, localData.lineStartInstruction, labelName)); + firstCode.add(firstCodePos, new LabelItem(dialect, null, localData.lineStartInstruction, labelName)); } - ret.add(new GotoItem(null, localData.lineStartInstruction, labelName)); + ret.add(new GotoItem(dialect, null, localData.lineStartInstruction, labelName)); return ret; } else { visited.add(part); @@ -2951,7 +2958,7 @@ public class Graph { if (topBsr != null) { stack.push(topBsr); } - loopItem = new UniversalLoopItem(null, localData.lineStartInstruction, currentLoop, new ArrayList<>()); + loopItem = new UniversalLoopItem(dialect, null, localData.lineStartInstruction, currentLoop, new ArrayList<>()); //loopItem.commands=printGraph(visited, localData, stack, allParts, parent, part, stopPart, loops); currentRet.add(loopItem); currentRet = loopItem.commands; @@ -3058,7 +3065,7 @@ public class Graph { } } while (exHappened); if ((part.end >= code.size() - 1) && getNextParts(localData, part).isEmpty()) { - output.add(new ScriptEndItem()); + output.add(new ScriptEndItem(dialect)); } } @@ -3236,13 +3243,13 @@ public class Graph { pos++; continue; } - caseValues.add(new IntegerValueItem(null, localData.lineStartInstruction, pos)); + caseValues.add(new IntegerValueItem(dialect, null, localData.lineStartInstruction, pos)); } else if (caseExpressions.containsKey(pos)) { GraphTargetItem expr = caseExpressions.get(pos); if (caseCommaCommands.get(pos).size() > 0) { List exprCommaCommands = new ArrayList<>(caseCommaCommands.get(pos)); exprCommaCommands.add(expr); - expr = new CommaExpressionItem(null, expr.lineStartItem, exprCommaCommands); + expr = new CommaExpressionItem(dialect, null, expr.lineStartItem, exprCommaCommands); } caseValues.add(expr); } else { @@ -3342,18 +3349,18 @@ public class Graph { GraphTargetItem ternarOnTrue; if (filteredOnTrue.size() > 1) { filteredOnTrue.set(filteredOnTrue.size() - 1, filteredOnTrue.get(filteredOnTrue.size() - 1).value); // replace Pushitem with its value - ternarOnTrue = new CommaExpressionItem(null, null, filteredOnTrue); + ternarOnTrue = new CommaExpressionItem(dialect, null, null, filteredOnTrue); } else { ternarOnTrue = filteredOnTrue.get(0).value; } GraphTargetItem ternarOnFalse; if (filteredOnFalse.size() > 1) { filteredOnFalse.set(filteredOnFalse.size() - 1, filteredOnFalse.get(filteredOnFalse.size() - 1).value); // replace Pushitem with its value - ternarOnFalse = new CommaExpressionItem(null, null, filteredOnFalse); + ternarOnFalse = new CommaExpressionItem(dialect, null, null, filteredOnFalse); } else { ternarOnFalse = filteredOnFalse.get(0).value; } - TernarOpItem top = new TernarOpItem(null, localData.lineStartInstruction, expr.invert(null), ternarOnTrue, ternarOnFalse); + TernarOpItem top = new TernarOpItem(dialect, null, localData.lineStartInstruction, expr.invert(null), ternarOnTrue, ternarOnFalse); stack.push(handleTernar(top, localData)); } else { boolean isIf = true; @@ -3382,7 +3389,7 @@ public class Graph { } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(prevExpr); } else { - stack.push(new OrItem(null, localData.lineStartInstruction, prevExpr, rightSide)); + stack.push(new OrItem(dialect, null, localData.lineStartInstruction, prevExpr, rightSide)); } } else if (leftSide.invert(null).getNotCoercedNoDup() instanceof DuplicateItem) { isIf = false; @@ -3391,7 +3398,7 @@ public class Graph { } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(prevExpr); } else { - stack.push(new AndItem(null, localData.lineStartInstruction, prevExpr, rightSide)); + stack.push(new AndItem(dialect, null, localData.lineStartInstruction, prevExpr, rightSide)); } } else if (prevExpr instanceof FalseItem) { isIf = false; @@ -3402,7 +3409,7 @@ public class Graph { } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof TrueItem) { stack.push(leftSide); } else { - stack.push(new AndItem(null, localData.lineStartInstruction, leftSide, rightSide)); + stack.push(new AndItem(dialect, null, localData.lineStartInstruction, leftSide, rightSide)); } } else if (prevExpr instanceof TrueItem) { isIf = false; @@ -3411,7 +3418,7 @@ public class Graph { } else if (hideEmptyTrueFalse && rightSide.getNotCoercedNoDup() instanceof FalseItem) { stack.push(leftSide); } else { - stack.push(new OrItem(null, localData.lineStartInstruction, leftSide, rightSide)); + stack.push(new OrItem(dialect, null, localData.lineStartInstruction, leftSide, rightSide)); } } else { stack.push(prevExpr); //push it back @@ -3424,13 +3431,13 @@ public class Graph { if (isIf) { makeAllCommands(currentRet, stack); - IfItem b = new IfItem(null, localData.lineStartInstruction, expr.invert(null), onTrue, onFalse); + IfItem b = new IfItem(dialect, null, localData.lineStartInstruction, expr.invert(null), onTrue, onFalse); b.decisionPart = part; b.onTruePart = nps.get(0); b.onFalsePart = nps.get(1); currentRet.add(b); if (processSubBlk(b, null)) { - stack.push(new PopItem(null, localData.lineStartInstruction)); + stack.push(new PopItem(dialect, null, localData.lineStartInstruction)); } } } @@ -3485,7 +3492,7 @@ public class Graph { expr = expr.invert(null); } exprList.add(expr); - ret.add(index, li = new DoWhileItem(null, expr.getLineStartItem(), currentLoop, loopItem.commands, exprList)); + ret.add(index, li = new DoWhileItem(dialect, null, expr.getLineStartItem(), currentLoop, loopItem.commands, exprList)); loopTypeFound = true; } } @@ -3530,7 +3537,7 @@ public class Graph { if (expr instanceof LogicalOpItem) { expr = ((LogicalOpItem) expr).invert(null); } else { - expr = new NotItem(null, expr.getLineStartItem(), expr); + expr = new NotItem(dialect, null, expr.getLineStartItem(), expr); } } exprList.add(expr); @@ -3566,9 +3573,9 @@ public class Graph { finalComm.addAll(precontinueCommands); } if (!finalComm.isEmpty()) { - ret.add(index, li = new ForItem(expr.getSrc(), expr.getLineStartItem(), currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands)); + ret.add(index, li = new ForItem(dialect, expr.getSrc(), expr.getLineStartItem(), currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands)); } else { - ret.add(index, li = new WhileItem(expr.getSrc(), expr.getLineStartItem(), currentLoop, exprList, commands)); + ret.add(index, li = new WhileItem(dialect, expr.getSrc(), expr.getLineStartItem(), currentLoop, exprList, commands)); } if (addBreakItem != null) { ret.add(index + 1, addBreakItem); @@ -3623,7 +3630,7 @@ public class Graph { commands.addAll(bodyBranch); exprList.add(expr); checkContinueAtTheEnd(commands, currentLoop); - ret.add(index, li = new DoWhileItem(null, exprList.get(0).getLineStartItem(), currentLoop, commands, exprList)); + ret.add(index, li = new DoWhileItem(dialect, null, exprList.get(0).getLineStartItem(), currentLoop, commands, exprList)); } loopTypeFound = true; @@ -4054,7 +4061,7 @@ public class Graph { //must go backwards to hit case 5, not case 4 for (int i = caseBodyParts.size() - 1; i >= 0; i--) { if (caseBodyParts.get(i) == defaultPart) { - DefaultItem di = new DefaultItem(); + DefaultItem di = new DefaultItem(dialect); caseValuesMap.add(i + 1, di); caseBodyParts.add(i + 1, defaultPart); hasDefault = true; @@ -4076,7 +4083,7 @@ public class Graph { //must go backwards to hit case 2, not case 1 for (int i = caseBodyParts.size() - 1; i >= 0; i--) { if (caseBodyParts.get(i).leadsTo(localData, this, code, defaultPart, loops, throwStates, false)) { - DefaultItem di = new DefaultItem(); + DefaultItem di = new DefaultItem(dialect); caseValuesMap.add(i + 1, di); caseBodyParts.add(i + 1, defaultPart); hasDefault = true; @@ -4097,7 +4104,7 @@ public class Graph { */ for (int i = 0; i < caseBodyParts.size(); i++) { if (defaultPart.leadsTo(localData, this, code, caseBodyParts.get(i), loops, throwStates, false)) { - DefaultItem di = new DefaultItem(); + DefaultItem di = new DefaultItem(dialect); caseValuesMap.add(i, di); caseBodyParts.add(i, defaultPart); hasDefault = true; @@ -4115,7 +4122,7 @@ public class Graph { default: trace("def"); */ - caseValuesMap.add(new DefaultItem()); + caseValuesMap.add(new DefaultItem(dialect)); caseBodyParts.add(defaultPart); } @@ -4197,7 +4204,7 @@ public class Graph { if (!currentCaseCommands.isEmpty()) { GraphTargetItem last = currentCaseCommands.get(currentCaseCommands.size() - 1); if (!(last instanceof ContinueItem) && !(last instanceof BreakItem) && !(last instanceof GotoItem) && !(last instanceof ExitItem) && !(last instanceof ScriptEndItem)) { - currentCaseCommands.add(new BreakItem(null, localData.lineStartInstruction, currentLoop.id)); + currentCaseCommands.add(new BreakItem(dialect, null, localData.lineStartInstruction, currentLoop.id)); } } } @@ -4280,7 +4287,7 @@ public class Graph { GraphTargetItem ti = checkLoop(new ArrayList<>() /*??*/, next, stopPart, loops, throwStates); tiRef.setVal(ti); - return new SwitchItem(null, switchStartItem, currentLoop, switchedObject, caseValuesMap, caseCommands, valuesMapping); + return new SwitchItem(dialect, null, switchStartItem, currentLoop, switchedObject, caseValuesMap, caseCommands, valuesMapping); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetDialect.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetDialect.java new file mode 100644 index 000000000..6ceb8e00d --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetDialect.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010-2024 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.graph; + +/** + * + * @author JPEXS + */ +public abstract class GraphTargetDialect { + + /** + * Identifier of the dialect. + * @return Name + */ + public abstract String getName(); + + /** + * Conversion of ECMA value (that's used in simplifications) + * back to GraphTarget item. + * @param value + * @return + */ + public abstract GraphTargetItem valToItem(Object value); +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java index 29bde9b25..0a337e4e7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -136,6 +136,11 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { * ASM Position */ protected int pos = 0; + + /** + * Dialect + */ + public GraphTargetDialect dialect; /** * Gets the line start item @@ -145,64 +150,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { public GraphSourceItem getLineStartItem() { return lineStartItem; } - - /** - * Converts a value to an item - * - * FIXME!!! This should only convert to values relatable to current Graph type, - * e.g. ActionItems for AS1/2, AVM2Items for AS3 - * - * @param r Value - * @return Graph target item - */ - protected static GraphTargetItem valToItem(Object r) { - if (r == null) { - return null; - } - if (r instanceof Boolean) { - if ((Boolean) r) { - return new TrueItem(null, null); - } else { - return new FalseItem(null, null); - } - } - if (r instanceof String) { - return new StringAVM2Item(null, null, (String) r); - } - if (r instanceof Long) { - return new DoubleValueAVM2Item(null, null, (double) (Long) r); - } - if (r instanceof Integer) { - return new IntegerValueAVM2Item(null, null, (Integer) r); - } - - if (r instanceof Double) { - return new DoubleValueAVM2Item(null, null, (Double) r); - } - if (r instanceof Null) { - return new NullAVM2Item(null, null); - } - if (r instanceof Undefined) { - return new UndefinedAVM2Item(null, null); - } - if (r instanceof ArrayType) { - List vals = new ArrayList<>(); - ArrayType at = (ArrayType) r; - for (Object v : at.values) { - vals.add(valToItem(v)); - } - return new NewArrayAVM2Item(null, null, vals); - } - if (r instanceof ObjectType) { - List props = new ArrayList<>(); - ObjectType ot = (ObjectType) r; - for (String k : ot.getAttributeNames()) { - props.add(new NameValuePair(valToItem(k), valToItem(ot.getAttribute(k)))); - } - return new NewObjectAVM2Item(null, null, props); - } - return null; - } + /** * Simplifies something @@ -237,7 +185,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { break; } - GraphTargetItem it2 = valToItem(r); + GraphTargetItem it2 = it.dialect == null ? null : it.dialect.valToItem(r); if (it2 == null) { return it; } @@ -297,8 +245,8 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { /** * Constructs GraphTargetItem */ - public GraphTargetItem() { - this(null, null, NOPRECEDENCE); + public GraphTargetItem(GraphTargetDialect dialect) { + this(dialect, null, null, NOPRECEDENCE); } /** @@ -308,8 +256,8 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { * @param lineStartItem Line start item * @param precedence Precedence */ - public GraphTargetItem(GraphSourceItem src, GraphSourceItem lineStartItem, int precedence) { - this(src, lineStartItem, precedence, null); + public GraphTargetItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartItem, int precedence) { + this(dialect, src, lineStartItem, precedence, null); } /** @@ -320,7 +268,8 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { * @param precedence Precedence * @param value Value */ - public GraphTargetItem(GraphSourceItem src, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value) { + public GraphTargetItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value) { + this.dialect = dialect; this.src = src; this.lineStartItem = lineStartItem; this.precedence = precedence; @@ -1064,7 +1013,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { * @return Inverted item */ public GraphTargetItem invert(GraphSourceItem src) { - return new NotItem(src, getLineStartItem(), this); + return new NotItem(dialect, src, getLineStartItem(), this); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java index ba2984b25..a9b93f289 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java @@ -38,7 +38,7 @@ public class MarkItem extends GraphTargetItem { * @param mark Mark string */ public MarkItem(String mark) { - super(null, null, NOPRECEDENCE); + super(null, null, null, NOPRECEDENCE); this.mark = mark; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java index 53328ef11..d4fe0b4fe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotCompileTimeItem.java @@ -40,7 +40,7 @@ public class NotCompileTimeItem extends GraphTargetItem { * @param object Object that cannot be statically computed */ public NotCompileTimeItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) { - super(instruction, lineStartIns, NOPRECEDENCE); + super(null, instruction, lineStartIns, NOPRECEDENCE); this.object = object; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TranslateStack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TranslateStack.java index b3eead414..e47754c1e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TranslateStack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TranslateStack.java @@ -95,7 +95,7 @@ public class TranslateStack extends Stack { */ private PopItem getPop() { if (pop == null) { - pop = new PopItem(null, null); //TODO: linestart? + pop = new PopItem(null, null, null); //TODO: linestart? } return pop; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeFunctionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeFunctionItem.java index f2f44e3c0..33db5b33e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeFunctionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeFunctionItem.java @@ -46,7 +46,7 @@ public class TypeFunctionItem extends GraphTargetItem { * @param fullTypeName Full type name */ public TypeFunctionItem(String fullTypeName) { - super(null, null, NOPRECEDENCE); + super(null, null, null, NOPRECEDENCE); this.fullTypeName = fullTypeName; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java index ab553bb2b..a7dcabee8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java @@ -108,7 +108,7 @@ public class TypeItem extends GraphTargetItem { * @param ns Namespace */ public TypeItem(DottedChain fullTypeName, List subtypes, String ns) { - super(null, null, NOPRECEDENCE); + super(null, null, null, NOPRECEDENCE); this.fullTypeName = fullTypeName; this.ns = ns; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java index 695d04475..f14627507 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; @@ -43,13 +44,14 @@ public class AndItem extends BinaryOpItem implements CompoundableBinaryOp { /** * Constructor. + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param leftSide Left side * @param rightSide Right side */ - public AndItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(src, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&", "Boolean", "Boolean"); + public AndItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { + super(dialect, src, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&", "Boolean", "Boolean"); this.leftSide = leftSide; this.rightSide = rightSide; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AnyItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AnyItem.java index 36b1c0fd7..da7dbd5fe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AnyItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AnyItem.java @@ -31,7 +31,7 @@ public class AnyItem extends GraphTargetItem { * Constructor. */ public AnyItem() { - + super(null); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java index d527a9fb0..b80431590 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOpItem.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.SimpleValue; @@ -71,6 +72,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp { /** * Constructor. * + * @param dialect Dialect * @param instruction Instruction * @param lineStartItem Line start item * @param precedence Precedence @@ -80,8 +82,8 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp { * @param coerceLeft Coerce left * @param coerceRight Coerce right */ - public BinaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator, String coerceLeft, String coerceRight) { - super(instruction, lineStartItem, precedence); + public BinaryOpItem(GraphTargetDialect dialect, GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator, String coerceLeft, String coerceRight) { + super(dialect, instruction, lineStartItem, precedence); this.leftSide = leftSide; this.rightSide = rightSide; this.operator = operator; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BlockItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BlockItem.java index 63001bb56..3aaab5107 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BlockItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BlockItem.java @@ -21,6 +21,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.SourceGenerator; @@ -41,13 +42,14 @@ public class BlockItem extends GraphTargetItem { /** * Constructor. - * + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param commands Commands */ - public BlockItem(GraphSourceItem src, GraphSourceItem lineStartIns, List commands) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public BlockItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, List commands) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); this.commands = commands; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BreakItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BreakItem.java index 14e7536ef..cc0584f3d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BreakItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BreakItem.java @@ -21,6 +21,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; @@ -46,12 +47,13 @@ public class BreakItem extends GraphTargetItem { /** * Constructor. * + * @param dialect Dialect * @param src Source item * @param lineStartIns Line start instruction * @param loopId Loop id */ - public BreakItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) { - super(src, lineStartIns, NOPRECEDENCE); + public BreakItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) { + super(dialect, src, lineStartIns, NOPRECEDENCE); this.loopId = loopId; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java index c606ef0d2..0a8d086a6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommaExpressionItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.SourceGenerator; @@ -41,12 +42,13 @@ public class CommaExpressionItem extends GraphTargetItem { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param commands Commands */ - public CommaExpressionItem(GraphSourceItem src, GraphSourceItem lineStartIns, List commands) { - super(src, lineStartIns, PRECEDENCE_COMMA); + public CommaExpressionItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, List commands) { + super(dialect, src, lineStartIns, PRECEDENCE_COMMA); this.commands = commands; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommentItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommentItem.java index 6fb66ce07..c06be26ab 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommentItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/CommentItem.java @@ -37,7 +37,7 @@ public class CommentItem extends GraphTargetItem { * @param comment Comment */ public CommentItem(String comment) { - super(null, null, NOPRECEDENCE); + super(null, null, null, NOPRECEDENCE); this.commentLines = new String[]{comment}; } @@ -46,7 +46,7 @@ public class CommentItem extends GraphTargetItem { * @param commentLines Comment lines */ public CommentItem(String[] commentLines) { - super(null, null, NOPRECEDENCE); + super(null, null, null, NOPRECEDENCE); this.commentLines = commentLines; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ContinueItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ContinueItem.java index cbc413ed7..23a71e448 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ContinueItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ContinueItem.java @@ -21,6 +21,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; @@ -46,12 +47,13 @@ public class ContinueItem extends GraphTargetItem { /** * Constructor. * + * @param dialect Dialect * @param src Source item * @param lineStartIns Line start instruction * @param loopId Loop id */ - public ContinueItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) { - super(src, lineStartIns, NOPRECEDENCE); + public ContinueItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) { + super(dialect, src, lineStartIns, NOPRECEDENCE); this.loopId = loopId; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DefaultItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DefaultItem.java index c2b0348a4..9c51c1046 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DefaultItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DefaultItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -25,6 +26,16 @@ import com.jpexs.decompiler.graph.TypeItem; */ public class DefaultItem extends GraphTargetItem { + /** + * Constructor + * @param dialect Dialect + */ + public DefaultItem(GraphTargetDialect dialect) { + super(dialect); + } + + + @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { return writer.append("default"); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DoWhileItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DoWhileItem.java index bacded6ee..22127310e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DoWhileItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DoWhileItem.java @@ -23,6 +23,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.Loop; @@ -96,8 +97,8 @@ public class DoWhileItem extends LoopItem implements Block { * @param commands Commands * @param expression Expression */ - public DoWhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List commands, List expression) { - super(src, lineStartIns, loop); + public DoWhileItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List commands, List expression) { + super(dialect, src, lineStartIns, loop); this.expression = expression; this.commands = commands; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java index 495b02617..c36d39252 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/DuplicateItem.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SimpleValue; import com.jpexs.decompiler.graph.SourceGenerator; @@ -36,12 +37,14 @@ public class DuplicateItem extends GraphTargetItem implements SimpleValue { /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start item * @param value Value */ - public DuplicateItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(src, lineStartIns, value.getPrecedence(), value); + public DuplicateItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) { + super(dialect, src, lineStartIns, value.getPrecedence(), value); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/EmptyCommand.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/EmptyCommand.java index a11d7e807..e34372b42 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/EmptyCommand.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/EmptyCommand.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -27,6 +28,13 @@ import com.jpexs.decompiler.graph.TypeItem; */ public class EmptyCommand extends GraphTargetItem { + /** + * @param dialect Dialect + */ + public EmptyCommand(GraphTargetDialect dialect) { + super(dialect); + } + @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { return writer; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/FalseItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/FalseItem.java index 389435c31..a95185a33 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/FalseItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/FalseItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SimpleValue; import com.jpexs.decompiler.graph.SourceGenerator; @@ -36,11 +37,13 @@ public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleV /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction */ - public FalseItem(GraphSourceItem src, GraphSourceItem lineStartIns) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public FalseItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); } @Override @@ -65,7 +68,7 @@ public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleV @Override public GraphTargetItem invert(GraphSourceItem neqSrc) { - return new TrueItem(getSrc(), getLineStartItem()); + return new TrueItem(dialect, getSrc(), getLineStartItem()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ForItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ForItem.java index ac9d59abb..4d60f1fb9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ForItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ForItem.java @@ -23,6 +23,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.Loop; @@ -100,6 +101,7 @@ public class ForItem extends LoopItem implements Block { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param loop Loop @@ -108,8 +110,8 @@ public class ForItem extends LoopItem implements Block { * @param finalCommands Final commands * @param commands Commands */ - public ForItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List firstCommands, GraphTargetItem expression, List finalCommands, List commands) { - super(src, lineStartIns, loop); + public ForItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List firstCommands, GraphTargetItem expression, List finalCommands, List commands) { + super(dialect, src, lineStartIns, loop); this.firstCommands = firstCommands; this.expression = expression; this.finalCommands = finalCommands; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/GotoItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/GotoItem.java index cbc4c4bfc..61ed08be4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/GotoItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/GotoItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Block; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.TypeItem; @@ -45,12 +46,13 @@ public class GotoItem extends GraphTargetItem implements Block { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param labelName Label name */ - public GotoItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public GotoItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); this.labelName = labelName; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IfItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IfItem.java index 888a7a9d0..527259a07 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IfItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IfItem.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.graph.Block; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.SimpleValue; @@ -110,14 +111,15 @@ public class IfItem extends GraphTargetItem implements Block { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param expression Expression * @param onTrue On true * @param onFalse On false */ - public IfItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, List onTrue, List onFalse) { - super(src, lineStartIns, NOPRECEDENCE); + public IfItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, List onTrue, List onFalse) { + super(dialect, src, lineStartIns, NOPRECEDENCE); this.expression = expression; this.onTrue = onTrue; this.onFalse = onFalse; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java index c6f9a2760..6c462eab6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/IntegerValueItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; import java.util.Set; @@ -36,12 +37,14 @@ public class IntegerValueItem extends GraphTargetItem implements IntegerValueTyp /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param value Value */ - public IntegerValueItem(GraphSourceItem src, GraphSourceItem lineStartIns, int value) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public IntegerValueItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, int value) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); this.intValue = value; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LabelItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LabelItem.java index 2c747adc2..8dab22cb6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LabelItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LabelItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -35,12 +36,14 @@ public class LabelItem extends GraphTargetItem { /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param labelName Label name */ - public LabelItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public LabelItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); this.labelName = labelName; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LoopItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LoopItem.java index 12364f24e..28e9a1d18 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LoopItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/LoopItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; import java.util.List; @@ -36,12 +37,13 @@ public abstract class LoopItem extends GraphTargetItem { /** * Constructor. * + * @param dialect Dialect * @param src Source item * @param lineStartItem Line start item * @param loop Loop */ - public LoopItem(GraphSourceItem src, GraphSourceItem lineStartItem, Loop loop) { - super(src, lineStartItem, NOPRECEDENCE); + public LoopItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartItem, Loop loop) { + super(dialect, src, lineStartItem, NOPRECEDENCE); this.loop = loop; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/NotItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/NotItem.java index 46cf50290..1d43f1b6c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/NotItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/NotItem.java @@ -22,6 +22,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SimpleValue; import com.jpexs.decompiler.graph.SourceGenerator; @@ -38,12 +39,14 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted { /** * Constructor. + * + * @param dialect Dialect * @param instruction Instruction * @param lineStartIns Line start instruction * @param value Value */ - public NotItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "!", "Boolean"); + public NotItem(GraphTargetDialect dialect, GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) { + super(dialect, instruction, lineStartIns, PRECEDENCE_UNARY, value, "!", "Boolean"); } @Override @@ -111,7 +114,7 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted { } //If it is not a boolean, put !! there for toBoolean conversion if (!TypeItem.BOOLEAN.equals(value.returnType()) && !(value instanceof DuplicateItem)) { - return new NotItem(null, null, this); + return new NotItem(dialect, null, null, this); } //can be inverted diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java index e223c5a7b..52522230a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; @@ -35,13 +36,15 @@ public class OrItem extends BinaryOpItem implements CompoundableBinaryOp { /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param leftSide Left side * @param rightSide Right side */ - public OrItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { - super(src, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||", "Boolean", "Boolean"); + public OrItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { + super(dialect, src, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||", "Boolean", "Boolean"); this.leftSide = leftSide; this.rightSide = rightSide; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java index 52994ac4d..074aaec7c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ParenthesisItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import java.util.List; @@ -33,12 +34,14 @@ public class ParenthesisItem extends GraphTargetItem { /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param value Value */ - public ParenthesisItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) { - super(src, lineStartIns, PRECEDENCE_PRIMARY, value); + public ParenthesisItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY, value); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PopItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PopItem.java index 8cd8e5668..2e8404cc3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PopItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PopItem.java @@ -21,6 +21,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; @@ -35,11 +36,13 @@ public class PopItem extends GraphTargetItem { /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction */ - public PopItem(GraphSourceItem src, GraphSourceItem lineStartIns) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public PopItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PushItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PushItem.java index 8efdd5711..605728d31 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PushItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/PushItem.java @@ -38,7 +38,7 @@ public class PushItem extends GraphTargetItem { * @param value Value to push */ public PushItem(GraphTargetItem value) { - super(value.getSrc(), value.getLineStartItem(), value.getPrecedence(), value); + super(value.dialect, value.getSrc(), value.getLineStartItem(), value.getPrecedence(), value); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java index bc1921960..9017d1107 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/ScriptEndItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; @@ -29,9 +30,11 @@ public class ScriptEndItem extends GraphTargetItem implements ExitItem { /** * Constructor. + * + * @param dialect Dialect */ - public ScriptEndItem() { - super(null, null, NOPRECEDENCE); + public ScriptEndItem(GraphTargetDialect dialect) { + super(dialect, null, null, NOPRECEDENCE); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/SwitchItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/SwitchItem.java index 595bf21dc..2490a585b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/SwitchItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/SwitchItem.java @@ -23,6 +23,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.Loop; @@ -87,6 +88,7 @@ public class SwitchItem extends LoopItem implements Block { /** * Constructor. + * @param dialect Dialect * @param instruction Instruction * @param lineStartIns Line start instruction * @param loop Loop @@ -95,8 +97,8 @@ public class SwitchItem extends LoopItem implements Block { * @param caseCommands Case commands * @param valuesMapping Values mapping */ - public SwitchItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, GraphTargetItem switchedObject, List caseValues, List> caseCommands, List valuesMapping) { - super(instruction, lineStartIns, loop); + public SwitchItem(GraphTargetDialect dialect, GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, GraphTargetItem switchedObject, List caseValues, List> caseCommands, List valuesMapping) { + super(dialect, instruction, lineStartIns, loop); this.switchedObject = switchedObject; this.caseValues = caseValues; this.caseCommands = caseCommands; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TernarOpItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TernarOpItem.java index 606137fd1..fe0ca1e40 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TernarOpItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TernarOpItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.SourceGenerator; @@ -52,14 +53,15 @@ public class TernarOpItem extends GraphTargetItem { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param expression Expression * @param onTrue On true * @param onFalse On false */ - public TernarOpItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) { - super(src, lineStartIns, PRECEDENCE_CONDITIONAL); + public TernarOpItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) { + super(dialect, src, lineStartIns, PRECEDENCE_CONDITIONAL); this.expression = expression; this.onTrue = onTrue; this.onFalse = onFalse; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TrueItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TrueItem.java index c5a168bb8..590bf052a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TrueItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/TrueItem.java @@ -20,6 +20,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SimpleValue; import com.jpexs.decompiler.graph.SourceGenerator; @@ -36,11 +37,13 @@ public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleVa /** * Constructor. + * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction */ - public TrueItem(GraphSourceItem src, GraphSourceItem lineStartIns) { - super(src, lineStartIns, PRECEDENCE_PRIMARY); + public TrueItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns) { + super(dialect, src, lineStartIns, PRECEDENCE_PRIMARY); } @Override @@ -65,7 +68,7 @@ public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleVa @Override public GraphTargetItem invert(GraphSourceItem neqSrc) { - return new FalseItem(getSrc(), getLineStartItem()); + return new FalseItem(dialect, getSrc(), getLineStartItem()); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java index 1a9f2fe33..ab54d5e68 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UnaryOpItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemPos; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import java.util.List; import java.util.Objects; @@ -44,6 +45,7 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp { /** * Constructor. * + * @param dialect Dialect * @param instruction Instruction * @param lineStartItem Line start item * @param precedence Precedence @@ -51,8 +53,8 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp { * @param operator Operator * @param coerce Coerce */ - public UnaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value, String operator, String coerce) { - super(instruction, lineStartItem, precedence, value); + public UnaryOpItem(GraphTargetDialect dialect, GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value, String operator, String coerce) { + super(dialect, instruction, lineStartItem, precedence, value); this.operator = operator; this.coerce = coerce; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java index 4b5c35762..880835d46 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/UniversalLoopItem.java @@ -18,9 +18,10 @@ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.graph.Block; import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.Loop; -import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -30,24 +31,16 @@ import java.util.List; */ public class UniversalLoopItem extends WhileItem implements Block { - /** - * True expression. - */ - static final List TRUE_EXPRESSION = new ArrayList<>(); - - static { - TRUE_EXPRESSION.add(new TrueItem(null, null)); - } - /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param loop Loop * @param commands Commands */ - public UniversalLoopItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List commands) { - super(src, lineStartIns, loop, TRUE_EXPRESSION, commands); + public UniversalLoopItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List commands) { + super(dialect, src, lineStartIns, loop, Arrays.asList(new TrueItem(dialect, src, lineStartIns)), commands); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/WhileItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/WhileItem.java index b740541bb..c88db0bae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/WhileItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/WhileItem.java @@ -23,6 +23,7 @@ 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.GraphTargetDialect; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.GraphTargetVisitorInterface; import com.jpexs.decompiler.graph.Loop; @@ -85,14 +86,15 @@ public class WhileItem extends LoopItem implements Block { /** * Constructor. * + * @param dialect Dialect * @param src Source * @param lineStartIns Line start instruction * @param loop Loop * @param expression Expression * @param commands Commands */ - public WhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List expression, List commands) { - super(src, lineStartIns, loop); + public WhileItem(GraphTargetDialect dialect, GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List expression, List commands) { + super(dialect, src, lineStartIns, loop); this.expression = expression; this.commands = commands; }