mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 07:11:04 +00:00
Fixed: #2355 AS1/2 Simplify expressions feature colliding with some other features like hex values
- introducing GraphTarget dialect
This commit is contained in:
@@ -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<Integer, GraphTargetItem> localRegs, ScopeStack scopeStack, ScopeStack localScopeStack, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, HashMap<Integer, Integer> 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<GraphTargetItem> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+88
@@ -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<GraphTargetItem> 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<NameValuePair> 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;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -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<GraphTargetItem> 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));
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -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<GraphTargetItem> output, String path) {
|
||||
stack.push(new FalseItem(ins, localData.lineStartInstruction));
|
||||
stack.push(new FalseItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -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<GraphTargetItem> output, String path) {
|
||||
stack.push(new TrueItem(ins, localData.lineStartInstruction));
|
||||
stack.push(new TrueItem(AVM2GraphTargetDialect.INSTANCE, ins, localData.lineStartInstruction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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<GraphTargetItem> commands) {
|
||||
super(instruction, lineStartIns, loop);
|
||||
super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, loop);
|
||||
|
||||
/*
|
||||
Following was commented out:
|
||||
|
||||
+2
-1
@@ -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<GraphTargetItem> commands) {
|
||||
super(instruction, lineStartIns, loop);
|
||||
super(AVM2GraphTargetDialect.INSTANCE, instruction, lineStartIns, loop);
|
||||
|
||||
//Commented out - see the comment in ForEachInAVM2Item
|
||||
/*if (!commands.isEmpty()) {
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+3
-2
@@ -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<NameValuePair> 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);
|
||||
|
||||
+25
-21
@@ -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<GraphTargetItem> 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());
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class ActionGraph extends Graph {
|
||||
* @param charset Charset
|
||||
*/
|
||||
public ActionGraph(Map<String, Map<String, Trait>> uninitializedClassTraits, String path, boolean insideDoInitAction, boolean insideFunction, List<Action> code, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> 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--;
|
||||
|
||||
@@ -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<GraphTargetItem> 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<GraphTargetItem> names = new ArrayList<>();
|
||||
List<GraphTargetItem> 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;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+25
-21
@@ -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<GraphTargetItem> 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<GraphTargetItem> doBody = new ArrayList<>();
|
||||
@@ -1203,7 +1207,7 @@ public class ActionScript2Parser {
|
||||
List<GraphTargetItem> 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<GraphTargetItem> 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<VariableActionItem> variables, Reference<Boolean> allowMemberOrCall, boolean inFunction, boolean inMethod, boolean inTellTarget, List<FunctionActionItem> functions, Reference<Boolean> 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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-1
@@ -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<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartAction, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> 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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user