From 8fa321cfd3c71f9e45645002bb4a22724a2169fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 8 Mar 2021 12:17:46 +0100 Subject: [PATCH] AS3 using temp registers on compound assignments when hasSideeffect --- .../avm2/model/operations/AddAVM2Item.java | 9 + .../avm2/model/operations/AsTypeAVM2Item.java | 11 +- .../avm2/model/operations/BitAndAVM2Item.java | 8 + .../avm2/model/operations/BitOrAVM2Item.java | 8 + .../avm2/model/operations/BitXorAVM2Item.java | 8 + .../avm2/model/operations/DivideAVM2Item.java | 8 + .../abc/avm2/model/operations/EqAVM2Item.java | 11 +- .../abc/avm2/model/operations/GeAVM2Item.java | 11 +- .../abc/avm2/model/operations/GtAVM2Item.java | 11 +- .../abc/avm2/model/operations/InAVM2Item.java | 11 +- .../model/operations/InstanceOfAVM2Item.java | 11 +- .../avm2/model/operations/IsTypeAVM2Item.java | 11 +- .../avm2/model/operations/LShiftAVM2Item.java | 8 + .../abc/avm2/model/operations/LeAVM2Item.java | 11 +- .../abc/avm2/model/operations/LtAVM2Item.java | 11 +- .../avm2/model/operations/ModuloAVM2Item.java | 8 + .../model/operations/MultiplyAVM2Item.java | 8 + .../avm2/model/operations/NeqAVM2Item.java | 12 +- .../avm2/model/operations/RShiftAVM2Item.java | 8 + .../model/operations/StrictEqAVM2Item.java | 11 +- .../model/operations/StrictNeqAVM2Item.java | 12 +- .../model/operations/SubtractAVM2Item.java | 8 + .../model/operations/URShiftAVM2Item.java | 8 + .../parser/script/AVM2SourceGenerator.java | 4 +- .../abc/avm2/parser/script/CallAVM2Item.java | 6 + .../script/ConstructSomethingAVM2Item.java | 5 + .../abc/avm2/parser/script/IndexAVM2Item.java | 67 +++++++- .../abc/avm2/parser/script/NameAVM2Item.java | 27 +++ .../abc/avm2/parser/script/NamespaceItem.java | 3 +- .../parser/script/NamespacedAVM2Item.java | 50 +++++- .../avm2/parser/script/PropertyAVM2Item.java | 161 +----------------- .../parser/script/UnresolvedAVM2Item.java | 27 +++ .../model/operations/AddActionItem.java | 8 + .../model/operations/AndActionItem.java | 11 +- .../model/operations/BitAndActionItem.java | 8 + .../model/operations/BitOrActionItem.java | 8 + .../model/operations/BitXorActionItem.java | 8 + .../model/operations/DivideActionItem.java | 8 + .../action/model/operations/EqActionItem.java | 11 +- .../action/model/operations/GeActionItem.java | 11 +- .../action/model/operations/GtActionItem.java | 11 +- .../action/model/operations/InActionItem.java | 11 +- .../operations/InstanceOfActionItem.java | 11 +- .../model/operations/LShiftActionItem.java | 8 + .../action/model/operations/LeActionItem.java | 14 +- .../action/model/operations/LtActionItem.java | 11 +- .../model/operations/ModuloActionItem.java | 8 + .../model/operations/MultiplyActionItem.java | 8 + .../model/operations/NeqActionItem.java | 13 +- .../action/model/operations/OrActionItem.java | 11 +- .../model/operations/RShiftActionItem.java | 8 + .../model/operations/StrictEqActionItem.java | 11 +- .../model/operations/StrictNeqActionItem.java | 13 +- .../model/operations/StringAddActionItem.java | 11 +- .../model/operations/StringEqActionItem.java | 11 +- .../model/operations/StringGeActionItem.java | 13 +- .../model/operations/StringGtActionItem.java | 11 +- .../model/operations/StringLeActionItem.java | 14 +- .../model/operations/StringLtActionItem.java | 11 +- .../model/operations/StringNeActionItem.java | 12 +- .../model/operations/SubtractActionItem.java | 8 + .../model/operations/URShiftActionItem.java | 9 + .../decompiler/graph/GraphTargetItem.java | 2 +- .../jpexs/decompiler/graph/model/AndItem.java | 9 +- .../decompiler/graph/model/BinaryOp.java | 3 + .../jpexs/decompiler/graph/model/OrItem.java | 6 + 66 files changed, 707 insertions(+), 197 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java index 9d4db33d4..f36507fe9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AddAVM2Item.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -97,4 +98,12 @@ public class AddAVM2Item extends BinaryOpItem implements CompoundableBinaryOp { public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Add, null)); + return ret; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java index bc047b18e..6b7637d11 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -23,6 +24,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -46,4 +48,11 @@ public class AsTypeAVM2Item extends BinaryOpItem { public GraphTargetItem returnType() { return rightSide; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.AsTypeLate, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java index 5859d46a9..9a01eb11c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitAndAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class BitAndAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.BitAnd, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java index 4b7138dbc..d5c23ba00 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitOrAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class BitOrAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.BitOr, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java index 1590db27a..165c10614 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/BitXorAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class BitXorAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.BitXor, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java index 3a09714e4..6ca6fe6e8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/DivideAVM2Item.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -84,4 +85,11 @@ public class DivideAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Divide, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java index 2dc5b56d5..46ae1c8ef 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/EqAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -71,4 +73,11 @@ public class EqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Equals, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java index 6689d0155..94ab013f1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GeAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -77,4 +79,11 @@ public class GeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.GreaterEquals, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java index 0577140a6..e6e7f2587 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/GtAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -77,4 +79,11 @@ public class GtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.GreaterThan, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java index 88a24ff6b..dd081dcb2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -48,4 +50,11 @@ public class InAVM2Item extends BinaryOpItem { public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.In, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java index 0ce069b05..9acca8002 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/InstanceOfAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -48,4 +50,11 @@ public class InstanceOfAVM2Item extends BinaryOpItem { public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.InstanceOf, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java index 14e3d2bd6..97848e0bf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -48,4 +50,11 @@ public class IsTypeAVM2Item extends BinaryOpItem { public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.IsTypeLate, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java index 602c2ada3..10a98e91e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LShiftAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class LShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.LShift, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java index 47ca6cb6c..d32fe82ab 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LeAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -76,4 +78,11 @@ public class LeAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.LessEquals, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java index a9e642a42..fae6a4f39 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/LtAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -77,4 +79,11 @@ public class LtAVM2Item extends BinaryOpItem implements LogicalOpItem, IfConditi public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.LessThan, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java index 646338869..7463ba154 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/ModuloAVM2Item.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -82,4 +83,11 @@ public class ModuloAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Modulo, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java index fe3800015..51590fa9c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/MultiplyAVM2Item.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -78,4 +79,11 @@ public class MultiplyAVM2Item extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Multiply, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java index f4cd7e533..182a13249 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/NeqAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -71,4 +73,12 @@ public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondit public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Equals, null)); + ret.add(new AVM2Instruction(0, AVM2Instructions.Not, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java index 29a667664..976fe68f9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/RShiftAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class RShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.RShift, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java index e7237cae9..f77c35bb7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictEqAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -28,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -74,4 +76,11 @@ public class StrictEqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfC public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.StrictEquals, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java index 62bc51822..e97df6481 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/StrictNeqAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -74,4 +76,12 @@ public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, If public GraphTargetItem returnType() { return new TypeItem(DottedChain.BOOLEAN); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.StrictEquals, null)); + ret.add(new AVM2Instruction(0, AVM2Instructions.Not, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java index e94052c1a..ba5d416e0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/SubtractAVM2Item.java @@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -87,4 +88,11 @@ public class SubtractAVM2Item extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.Subtract, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java index ebcdada9d..94e35a0b3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/URShiftAVM2Item.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +55,11 @@ public class URShiftAVM2Item extends BinaryOpItem implements CompoundableBinaryO public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new AVM2Instruction(0, AVM2Instructions.URShift, null)); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 51d89f155..fd2e43c72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -1994,7 +1994,9 @@ public class AVM2SourceGenerator implements SourceGenerator { } } for (int i = 1; i < registerNames.size(); i++) { - mbodyCode.add(i - 1, ins(AVM2Instructions.Debug, 1, str(registerNames.get(i)), i - 1, (int) registerLines.get(i))); + if (!needsActivation) { + mbodyCode.add(i - 1, ins(AVM2Instructions.Debug, 1, str(registerNames.get(i)), i - 1, (int) registerLines.get(i))); + } } if (!subMethod) { mbodyCode.add(0, new AVM2Instruction(0, AVM2Instructions.GetLocal0, null)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java index f413ca034..1f2455614 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/CallAVM2Item.java @@ -208,4 +208,10 @@ public class CallAVM2Item extends AVM2Item { public boolean hasReturnValue() { return true; } + + @Override + public boolean hasSideEffect() { + return true; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java index 699ca1e1c..4ab1d179d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ConstructSomethingAVM2Item.java @@ -98,4 +98,9 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item { } return toSourceMerge(localData, generator, resname, arguments, ins(AVM2Instructions.Construct, arguments.size())); } + + @Override + public boolean hasSideEffect() { + return true; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java index a25b864cf..39a74b1f0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/IndexAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.parser.script; import com.jpexs.helpers.Reference; @@ -25,10 +26,12 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; +import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * @@ -112,6 +115,34 @@ public class IndexAVM2Item extends AssignableAVM2Item { Reference ret_temp = new Reference<>(-1); if (assignedValue != null) { + + if (assignedValue instanceof CompoundableBinaryOp) { + CompoundableBinaryOp comp = (CompoundableBinaryOp) assignedValue; + if (comp.getLeftSide() instanceof IndexAVM2Item) { + IndexAVM2Item left = (IndexAVM2Item) comp.getLeftSide(); + if (left.assignedValue == null && Objects.equals(left.object, object) && Objects.equals(left.index, index) && index.hasSideEffect()) { + Reference val_temp = new Reference<>(-1); + Reference index_temp = new Reference<>(-1); + return toSourceMerge(localData, generator, + index, + setTemp(localData, generator, index_temp), + object, + getTemp(localData, generator, index_temp), + ins(AVM2Instructions.GetProperty, indexPropIndex), + comp.getRightSide(), + comp.getOperatorInstruction(), + setTemp(localData, generator, val_temp), + object, + getTemp(localData, generator, index_temp), + getTemp(localData, generator, val_temp), + needsReturn ? dupSetTemp(localData, generator, ret_temp) : null, + ins(AVM2Instructions.SetProperty, indexPropIndex), + needsReturn ? getTemp(localData, generator, ret_temp) : null, + killTemp(localData, generator, Arrays.asList(index_temp, val_temp, ret_temp))); + } + } + } + return toSourceMerge(localData, generator, object, index, @@ -143,4 +174,38 @@ public class IndexAVM2Item extends AssignableAVM2Item { public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSource(localData, generator, false, false, new ArrayList<>(), false, false); } + + @Override + public int hashCode() { + int hash = 3; + hash = 89 * hash + Objects.hashCode(this.object); + hash = 89 * hash + Objects.hashCode(this.index); + hash = 89 * hash + (this.attr ? 1 : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final IndexAVM2Item other = (IndexAVM2Item) obj; + if (this.attr != other.attr) { + return false; + } + if (!Objects.equals(this.object, other.object)) { + return false; + } + if (!Objects.equals(this.index, other.index)) { + return false; + } + return true; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java index 8b4ed0789..05a7e4b77 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NameAVM2Item.java @@ -41,6 +41,7 @@ import com.jpexs.decompiler.graph.model.UnboundedTypeItem; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * @@ -352,4 +353,30 @@ public class NameAVM2Item extends AssignableAVM2Item { slotNumber > -1 ? ins(AVM2Instructions.SetSlot, slotNumber) : null ); } + + @Override + public int hashCode() { + int hash = 7; + hash = 13 * hash + Objects.hashCode(this.variableName); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final NameAVM2Item other = (NameAVM2Item) obj; + if (!Objects.equals(this.variableName, other.variableName)) { + return false; + } + return true; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java index 28aa840d4..64c15779b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespaceItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.parser.script; import com.jpexs.helpers.Reference; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java index 172fd9454..283159015 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/NamespacedAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.parser.script; import com.jpexs.helpers.Reference; @@ -32,6 +33,7 @@ import com.jpexs.decompiler.graph.model.LocalData; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * @@ -214,4 +216,50 @@ public class NamespacedAVM2Item extends AssignableAVM2Item { public List toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException { return toSource(localData, generator, false, false, new ArrayList<>(), false, false); } + + @Override + public int hashCode() { + int hash = 3; + hash = 59 * hash + Objects.hashCode(this.ns); + hash = 59 * hash + Objects.hashCode(this.name); + hash = 59 * hash + Objects.hashCode(this.nameItem); + hash = 59 * hash + Objects.hashCode(this.obj); + hash = 59 * hash + (this.attr ? 1 : 0); + hash = 59 * hash + Objects.hashCode(this.openedNamespaces); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final NamespacedAVM2Item other = (NamespacedAVM2Item) obj; + if (this.attr != other.attr) { + return false; + } + if (!Objects.equals(this.name, other.name)) { + return false; + } + if (!Objects.equals(this.ns, other.ns)) { + return false; + } + if (!Objects.equals(this.nameItem, other.nameItem)) { + return false; + } + if (!Objects.equals(this.obj, other.obj)) { + return false; + } + if (!Objects.equals(this.openedNamespaces, other.openedNamespaces)) { + return false; + } + return true; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index 785374aa2..3eb198b69 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -40,12 +40,14 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; +import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -450,165 +452,6 @@ public class PropertyAVM2Item extends AssignableAVM2Item { return propIndex.getVal(); } - /* - private String resolveObjectType() { - String objType = object == null ? null : object.returnType().toString(); - if (objType == null) { - loopo: - for (int i = 0; i < openedNamespaces.size(); i++) { - int nsindex = openedNamespaces.get(i); - int nsKind = abc.constants.constant_namespace.get(openedNamespaces.get(i)).kind; - String nsname = abc.constants.constant_namespace.get(openedNamespaces.get(i)).getName(abc.constants); - int name_index = 0; - for (int m = 1; m < abc.constants.constant_multiname.size(); m++) { - Multiname mname = abc.constants.constant_multiname.get(m); - if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList<>()).equals(propertyName) && mname.namespace_index == nsindex) { - name_index = m; - break; - } - } - if (name_index > 0) { - for (int s = 0; s < abc.script_info.size(); s++) { - for (Trait t : abc.script_info.get(s).traits.traits) { - if (t.name_index == name_index) { - return getTraitReturnType(abc, t).toString(); - } - } - } - for (int c = 0; c < abc.instance_info.size(); c++) { - for (Trait t : abc.instance_info.get(c).instance_traits.traits) { - if (t.name_index == name_index) { - return getTraitReturnType(abc, t).toString(); - } - } - for (Trait t : abc.class_info.get(c).static_traits.traits) { - if (t.name_index == name_index) { - return getTraitReturnType(abc, t).toString(); - } - } - } - } - if (nsKind == Namespace.KIND_PACKAGE) { - List abcs = new ArrayList<>(); - abcs.add(abc); - abcs.addAll(otherABCs); - loopabc: - for (ABC a : otherABCs) { - for (int h = 0; h < a.instance_info.size(); h++) { - InstanceInfo ii = a.instance_info.get(h); - Multiname n = a.constants.constant_multiname.get(ii.name_index); - if (n.getNamespace(a.constants).kind == Namespace.KIND_PACKAGE && n.getNamespace(a.constants).getName(a.constants).equals(nsname)) { - Reference outName = new Reference<>(""); - Reference outNs = new Reference<>(""); - Reference outPropNs = new Reference<>(""); - Reference outPropNsKind = new Reference<>(1); - if (AVM2SourceGenerator.searchPrototypeChain(abcs, nsname, n.getName(a.constants, new ArrayList<>()), propertyName, outName, outNs, outPropNs, outPropNsKind)) { - return "".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal(); - } - } - } - } - } - } - } - if (objType == null) { - throw new RuntimeException("Unresolved object type"); - } - return objType; - }*/ - - /* - public GraphTargetItem resolvePropertyType() { - if (index != null) { - return TypeItem.UNBOUNDED; - } - - String objType = resolveObjectType(); - for (ABC a : abcs) { - int ci = a.findClassByName(objType); - if (ci != -1) { - for (Trait t : a.instance_info.get(ci).instance_traits.traits) { - String tnames = t.getName(a).getName(a.constants, new ArrayList<>()); - if (tnames.equals(propertyName)) { - if (t instanceof TraitSlotConst) { - TraitSlotConst tsc = (TraitSlotConst) t; - if (tsc.type_index == 0) { - return TypeItem.UNBOUNDED; - } - return new TypeItem(a.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(a.constants)); - } - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter tmgs = (TraitMethodGetterSetter) t; - if (tmgs.kindType == Trait.TRAIT_GETTER) { - return new TypeItem(a.constants.constant_multiname.get(a.method_info.get(tmgs.method_info).ret_type).getNameWithNamespace(a.constants)); - } - if (tmgs.kindType == Trait.TRAIT_SETTER) { - return new TypeItem(a.constants.constant_multiname.get(a.method_info.get(tmgs.method_info).param_types[0]).getNameWithNamespace(a.constants)); - } - } - if (t instanceof TraitFunction) { - return new TypeItem("Function"); - } - return TypeItem.UNBOUNDED; - } - } - break; - } - } - return TypeItem.UNBOUNDED; - } - */ - /* public int resolveProperty() { - if (index != null) { - return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, - abc.constants.getStringId(propertyName, true), 0, - allNsSet(), 0, new ArrayList()), true); - } - - String objType = resolveObjectType(); - for (ABC a : abcs) { - int ci = a.findClassByName(objType); - if (ci != -1) { - for (Trait t : a.instance_info.get(ci).instance_traits.traits) { - Multiname tname = t.getName(a); - String tnames = t.getName(a).getName(a.constants, new ArrayList<>()); - if (tnames.equals(propertyName)) { - return abc.constants.getMultinameId(new Multiname(tname.kind, - abc.constants.getStringId(tnames, true), - abc.constants.getNamespaceId(new Namespace(tname.getNamespace(a.constants).kind, abc.constants.getStringId(tname.getNamespace(a.constants).getName(a.constants), true)), 0, true), 0, 0, new ArrayList()), true); - } - } - for (Trait t : a.class_info.get(ci).static_traits.traits) { - Multiname tname = t.getName(a); - String tnames = t.getName(a).getName(a.constants, new ArrayList<>()); - if (tnames.equals(propertyName)) { - return abc.constants.getMultinameId(new Multiname(tname.kind, - abc.constants.getStringId(tnames, true), - abc.constants.getNamespaceId(new Namespace(tname.getNamespace(a.constants).kind, abc.constants.getStringId(tname.getNamespace(a.constants).getName(a.constants), true)), 0, true), 0, 0, new ArrayList()), true); - } - } - break; - } - } - - for (ABC a : abcs) { - for (ScriptInfo si : a.script_info) { - for (Trait t : si.traits.traits) { - Multiname tname = t.getName(a); - String tnames = t.getName(a).getName(a.constants, new ArrayList<>()); - if (tnames.equals(propertyName)) { - return abc.constants.getMultinameId(new Multiname(tname.kind, - abc.constants.getStringId(tnames, true), - abc.constants.getNamespaceId(new Namespace(tname.getNamespace(a.constants).kind, abc.constants.getStringId(tname.getNamespace(a.constants).getName(a.constants), true)), 0, true), 0, 0, new ArrayList()), true); - } - } - } - } - - return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, - abc.constants.getStringId(propertyName, true), 0, - allNsSet(), 0, new ArrayList()), true); - }*/ @Override public GraphTargetItem returnType() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java index 031df9f73..6ec6d3316 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java @@ -42,6 +42,7 @@ import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.LocalData; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @@ -509,4 +510,30 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item { } return resolvedRoot = ret; } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + Objects.hashCode(this.name); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final UnresolvedAVM2Item other = (UnresolvedAVM2Item) obj; + if (!Objects.equals(this.name, other.name)) { + return false; + } + return true; + } + } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java index 4bc787be7..958d1461d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AddActionItem.java @@ -30,6 +30,7 @@ import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; +import java.util.ArrayList; import java.util.List; /** @@ -91,4 +92,11 @@ public class AddActionItem extends BinaryOpItem implements CompoundableBinaryOp public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionAdd2()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java index dbedcf5a2..468812fd9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/AndActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +56,11 @@ public class AndActionItem extends BinaryOpItem { public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionAnd()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java index af0e0fbf9..427d7befd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitAndActionItem.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -56,4 +57,11 @@ public class BitAndActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitAnd()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java index 9ce1d6c6c..e6632a5de 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitOrActionItem.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -56,4 +57,11 @@ public class BitOrActionItem extends BinaryOpItem implements CompoundableBinaryO public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitOr()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java index 243c9d912..c1e4e9a9d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/BitXorActionItem.java @@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -76,4 +77,11 @@ public class BitXorActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitXor()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java index 97316f6a7..ba6235b29 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/DivideActionItem.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -60,4 +61,11 @@ public class DivideActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return new UnboundedTypeItem(); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionDivide()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java index 557872e65..ddff18c7e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/EqActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -70,4 +72,11 @@ public class EqActionItem extends BinaryOpItem implements LogicalOpItem, EqualsT public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionEquals2()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java index 06ae67555..9e123c2e1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GeActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -30,6 +31,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -76,4 +78,11 @@ public class GeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionLess2()); //FIXME!!! + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java index 3eaa59ab4..2d810731c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/GtActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -29,6 +30,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -74,4 +76,11 @@ public class GtActionItem extends BinaryOpItem implements LogicalOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionGreater()); //FIXME!!! + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java index 3e526b5cb..0faa56dfd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.action.model.ActionItem; @@ -20,6 +21,8 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; +import java.util.List; import java.util.Set; /** @@ -41,4 +44,10 @@ public class InActionItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java index 7c765e788..0964d4706 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/InstanceOfActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -23,6 +24,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -50,4 +52,11 @@ public class InstanceOfActionItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionInstanceOf()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java index 434aaa262..cefa7f429 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LShiftActionItem.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; +import java.util.ArrayList; import java.util.List; /** @@ -56,4 +57,11 @@ public class LShiftActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitLShift()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java index 8986b0e05..a7743747a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LeActionItem.java @@ -12,11 +12,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; +import com.jpexs.decompiler.flash.action.special.ActionNop; import com.jpexs.decompiler.flash.action.swf4.ActionLess; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionLess2; @@ -30,6 +32,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -71,4 +74,13 @@ public class LeActionItem extends BinaryOpItem implements LogicalOpItem, Inverte public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + //FIXME!!! + ret.add(new ActionGreater()); + ret.add(new ActionNot()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java index 8ed806086..024255cd8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/LtActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -29,6 +30,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -79,4 +81,11 @@ public class LtActionItem extends BinaryOpItem implements LogicalOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionLess2()); //FIXME!!! + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java index c3166cc75..ac64d8826 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/ModuloActionItem.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; +import java.util.ArrayList; import java.util.List; /** @@ -58,4 +59,11 @@ public class ModuloActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionModulo()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java index 81eff7189..6273b21f3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/MultiplyActionItem.java @@ -25,6 +25,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; +import java.util.ArrayList; import java.util.List; /** @@ -55,4 +56,11 @@ public class MultiplyActionItem extends BinaryOpItem implements CompoundableBina public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionMultiply()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java index 2f2eaec68..c34482169 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/NeqActionItem.java @@ -12,11 +12,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ 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.special.ActionNop; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -27,6 +29,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -66,4 +69,12 @@ public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Invert public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionEquals2()); + ret.add(new ActionNot()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java index 25729e54e..8ec1896ff 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/OrActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -54,4 +56,11 @@ public class OrActionItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionOr()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java index f8be45866..e6247a13f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/RShiftActionItem.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; +import java.util.ArrayList; import java.util.List; /** @@ -57,4 +58,11 @@ public class RShiftActionItem extends BinaryOpItem implements CompoundableBinary public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitRShift()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java index 6091c290a..2a0259a5e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictEqActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -26,6 +27,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -63,4 +65,11 @@ public class StrictEqActionItem extends BinaryOpItem implements LogicalOpItem, I public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStrictEquals()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java index 7108eb346..9690cb4e3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StrictNeqActionItem.java @@ -12,11 +12,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.swf4.ActionNot; +import com.jpexs.decompiler.flash.action.swf4.ActionStringEquals; import com.jpexs.decompiler.flash.action.swf6.ActionStrictEquals; import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; @@ -26,6 +28,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.LogicalOpItem; +import java.util.ArrayList; import java.util.List; /** @@ -59,4 +62,12 @@ public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem, public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStrictEquals()); + ret.add(new ActionNot()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java index e322ac015..a9b819fd3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringAddActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -60,4 +62,11 @@ public class StringAddActionItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringAdd()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java index bfc961fe7..56077ce01 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringEqActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -65,4 +67,11 @@ public class StringEqActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringNeActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringEquals()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java index c9af80c24..8393c9283 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGeActionItem.java @@ -12,10 +12,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.special.ActionNop; import com.jpexs.decompiler.flash.action.swf4.ActionNot; import com.jpexs.decompiler.flash.action.swf4.ActionStringLess; import com.jpexs.decompiler.flash.ecma.EcmaScript; @@ -25,6 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -62,4 +65,12 @@ public class StringGeActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringLtActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringLess()); + ret.add(new ActionNot()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java index 31c82b12a..a792f7b61 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringGtActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -26,6 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -71,4 +73,11 @@ public class StringGtActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringLeActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringGreater()); //FIXME!!! + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java index 6e896a918..5a6b243f5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLeActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,6 +28,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -58,7 +60,7 @@ public class StringLeActionItem extends BinaryOpItem implements Inverted { return toSourceMerge(localData, generator, leftSide, rightSide, new ActionStringGreater(), new ActionNot()); } - return toSourceMerge(localData, generator, rightSide, leftSide, new ActionStringLess(), new ActionNot()); + return toSourceMerge(localData, generator, rightSide, leftSide, new ActionStringLess(), new ActionNot()); //TODO: is this correct? } @Override @@ -70,4 +72,12 @@ public class StringLeActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringGtActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringGreater()); + ret.add(new ActionNot()); //FIXME!!! + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java index b0b647806..492acaf29 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringLtActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -65,4 +67,11 @@ public class StringLtActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringGeActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringLess()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java index 1f491af15..aaeb1a149 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/StringNeActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -24,6 +25,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -56,4 +58,12 @@ public class StringNeActionItem extends BinaryOpItem implements Inverted { public GraphTargetItem invert(GraphSourceItem negSrc) { return new StringEqActionItem(getSrc(), getLineStartItem(), leftSide, rightSide); } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionStringEquals()); + ret.add(new ActionNot()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java index 1f7532129..048c1f031 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/SubtractActionItem.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; import com.jpexs.decompiler.graph.model.LocalData; +import java.util.ArrayList; import java.util.List; /** @@ -89,4 +90,11 @@ public class SubtractActionItem extends BinaryOpItem implements CompoundableBina public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionSubtract()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java index 5125aeca5..f2d947868 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/operations/URShiftActionItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.swf5.ActionBitRShift; import com.jpexs.decompiler.flash.action.swf5.ActionBitURShift; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; @@ -25,6 +26,7 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.CompoundableBinaryOp; +import java.util.ArrayList; import java.util.List; /** @@ -57,4 +59,11 @@ public class URShiftActionItem extends BinaryOpItem implements CompoundableBinar public GraphTargetItem returnType() { return TypeItem.UNBOUNDED; } + + @Override + public List getOperatorInstruction() { + List ret = new ArrayList<>(); + ret.add(new ActionBitURShift()); + return ret; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java index abf7682c7..7b268a171 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -585,7 +585,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { public abstract GraphTargetItem returnType(); @Override - protected GraphTargetItem clone() { + public GraphTargetItem clone() { try { return (GraphTargetItem) super.clone(); } catch (CloneNotSupportedException ex) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java index af2c926cc..bf98c40cc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/AndItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.graph.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -22,6 +23,7 @@ import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -58,4 +60,9 @@ public class AndItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + return new ArrayList<>(); //??? + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOp.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOp.java index 197dee08e..5a2040866 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOp.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/BinaryOp.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.graph.model; +import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import java.util.List; @@ -38,4 +39,6 @@ public interface BinaryOp { public List getAllSubItems(); public String getOperator(); + + public List getOperatorInstruction(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java index 9151a6583..d019720aa 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/model/OrItem.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; +import java.util.ArrayList; import java.util.List; /** @@ -59,4 +60,9 @@ public class OrItem extends BinaryOpItem { public GraphTargetItem returnType() { return TypeItem.BOOLEAN; } + + @Override + public List getOperatorInstruction() { + return new ArrayList<>(); //??? + } }