diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c1058aa1..c2091df29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. - [#2052], [#2058] Adding new script placing class to incorrect DoABC tag - [#2072] AS3 direct editation - incorrectly using trait names of top level classes - [#2029] Simplify expressions stripping getlex and also ignoring some types of expressions +- [#2052] Detection of switches based on notequal operator ### Changed - [#2070] String values inside SWF to XML export are backslash escaped diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/HarmanDecryption.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/HarmanDecryption.java index 925774328..c6a4a379e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/HarmanDecryption.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/HarmanDecryption.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2023 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ 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 c05d8efb4..8efc82b22 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 @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.NotEqualsTypeItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; @@ -34,7 +35,7 @@ import java.util.List; * * @author JPEXS */ -public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { +public class NeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition, NotEqualsTypeItem { public NeqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=", "", ""); 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 037a27438..d28d2e530 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 @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.NotEqualsTypeItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; @@ -34,7 +35,7 @@ import java.util.List; * * @author JPEXS */ -public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition { +public class StrictNeqAVM2Item extends BinaryOpItem implements LogicalOpItem, IfCondition, NotEqualsTypeItem { public StrictNeqAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/Flasm3Lexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/Flasm3Lexer.java index 8d795d95b..b8636d048 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/Flasm3Lexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/Flasm3Lexer.java @@ -1,7 +1,5 @@ -/* The following code was generated by JFlex 1.6.0 */ - /* - * Copyright (C) 2010-2021 JPEXS, All rights reserved. + * Copyright (C) 2010-2023 JPEXS, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,7 +14,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. */ -/* Flash assembler language lexer specification */ package com.jpexs.decompiler.flash.abc.avm2.parser.pcode; import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java index 5188b18f2..ba574d9a1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoLexer.java @@ -1,7 +1,5 @@ -/* The following code was generated by JFlex 1.6.0 */ - /* - * Copyright (C) 2010-2016 JPEXS, All rights reserved. + * Copyright (C) 2010-2023 JPEXS, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,7 +14,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. */ -/* Method info lexer specification */ package com.jpexs.decompiler.flash.abc.methodinfo_parser; 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 2259b453d..bce021c89 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 @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.NotEqualsTypeItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; @@ -35,7 +36,7 @@ import java.util.List; * * @author JPEXS */ -public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Inverted { +public class NeqActionItem extends BinaryOpItem implements LogicalOpItem, Inverted, NotEqualsTypeItem { boolean version2; 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 2ef36d297..051a2534f 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 @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; +import com.jpexs.decompiler.graph.NotEqualsTypeItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.BinaryOpItem; @@ -34,7 +35,7 @@ import java.util.List; * * @author JPEXS */ -public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem, Inverted { +public class StrictNeqActionItem extends BinaryOpItem implements LogicalOpItem, Inverted, NotEqualsTypeItem { public StrictNeqActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) { super(instruction, lineStartIns, PRECEDENCE_EQUALITY, leftSide, rightSide, "!==", "", ""); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/graphviz/Flasm3Lexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/graphviz/Flasm3Lexer.java index 88ca4cb0b..b44cb9a74 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/graphviz/Flasm3Lexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/graphviz/Flasm3Lexer.java @@ -1,7 +1,5 @@ -/* The following code was generated by JFlex 1.6.0 */ - /* - * Copyright (C) 2010-2021 JPEXS, All rights reserved. + * Copyright (C) 2010-2023 JPEXS, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 76c41a6e9..291587a30 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.model.AndItem; +import com.jpexs.decompiler.graph.model.BinaryOpItem; import com.jpexs.decompiler.graph.model.BranchStackResistant; import com.jpexs.decompiler.graph.model.BreakItem; import com.jpexs.decompiler.graph.model.CommaExpressionItem; @@ -2346,19 +2347,27 @@ public class Graph { if (it instanceof IfItem) { IfItem ii = (IfItem) it; - if (ii.expression instanceof EqualsTypeItem) { - if (!ii.onFalse.isEmpty() && !ii.onTrue.isEmpty() - && ii.onTrue.get(ii.onTrue.size() - 1) instanceof PushItem - && ii.onTrue.get(ii.onTrue.size() - 1).value instanceof IntegerValueTypeItem) { - int cpos = ((IntegerValueTypeItem) ii.onTrue.get(ii.onTrue.size() - 1).value).intValue(); + List iiOnTrue = ii.onTrue; + List iiOnFalse = ii.onFalse; + if ((ii.expression instanceof EqualsTypeItem) || (ii.expression instanceof NotEqualsTypeItem)) { + + if (ii.expression instanceof NotEqualsTypeItem) { + iiOnTrue = ii.onFalse; + iiOnFalse = ii.onTrue; + } + + if (!iiOnFalse.isEmpty() && !iiOnTrue.isEmpty() + && iiOnTrue.get(iiOnTrue.size() - 1) instanceof PushItem + && iiOnTrue.get(iiOnTrue.size() - 1).value instanceof IntegerValueTypeItem) { + int cpos = ((IntegerValueTypeItem) iiOnTrue.get(iiOnTrue.size() - 1).value).intValue(); caseCommaCommands.put(cpos, commaCommands); - caseExpressionLeftSides.put(cpos, ((EqualsTypeItem) ii.expression).getLeftSide()); - caseExpressionRightSides.put(cpos, ((EqualsTypeItem) ii.expression).getRightSide()); + caseExpressionLeftSides.put(cpos, ((BinaryOpItem) ii.expression).getLeftSide()); + caseExpressionRightSides.put(cpos, ((BinaryOpItem) ii.expression).getRightSide()); commaCommands = new ArrayList<>(); - for (int f = 0; f < ii.onFalse.size() - 1; f++) { - commaCommands.add(ii.onFalse.get(f)); + for (int f = 0; f < iiOnFalse.size() - 1; f++) { + commaCommands.add(iiOnFalse.get(f)); } - it = ii.onFalse.get(ii.onFalse.size() - 1); + it = iiOnFalse.get(iiOnFalse.size() - 1); if (it instanceof PushItem) { it = it.value; } @@ -2374,14 +2383,21 @@ public class Graph { } } else if (it instanceof TernarOpItem) { TernarOpItem to = (TernarOpItem) it; - if (to.expression instanceof EqualsTypeItem) { - if (to.onTrue instanceof IntegerValueTypeItem) { - int cpos = ((IntegerValueTypeItem) to.onTrue).intValue(); - caseExpressionLeftSides.put(cpos, ((EqualsTypeItem) to.expression).getLeftSide()); - caseExpressionRightSides.put(cpos, ((EqualsTypeItem) to.expression).getRightSide()); + GraphTargetItem toOnTrue = to.onTrue; + GraphTargetItem toOnFalse = to.onFalse; + if ((to.expression instanceof EqualsTypeItem) || (to.expression instanceof NotEqualsTypeItem)) { + if (to.expression instanceof NotEqualsTypeItem) { + toOnTrue = to.onFalse; + toOnFalse = to.onTrue; + } + + if (toOnTrue instanceof IntegerValueTypeItem) { + int cpos = ((IntegerValueTypeItem) toOnTrue).intValue(); + caseExpressionLeftSides.put(cpos, ((BinaryOpItem) to.expression).getLeftSide()); + caseExpressionRightSides.put(cpos, ((BinaryOpItem) to.expression).getRightSide()); caseCommaCommands.put(cpos, commaCommands); commaCommands = new ArrayList<>(); - it = to.onFalse; + it = toOnFalse; if (it instanceof CommaExpressionItem) { commaCommands = new ArrayList<>(); CommaExpressionItem ce = (CommaExpressionItem) it; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotEqualsTypeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotEqualsTypeItem.java new file mode 100644 index 000000000..ce1f8f396 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/NotEqualsTypeItem.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2010-2023 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.graph; + +import com.jpexs.decompiler.graph.model.BinaryOp; + +/** + * + * @author JPEXS + */ +public interface NotEqualsTypeItem extends BinaryOp { +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/utf8/Utf8Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/utf8/Utf8Helper.java index fc453e505..55ccc7eb2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/utf8/Utf8Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/utf8/Utf8Helper.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2023 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3AssembledDecompileTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3AssembledDecompileTest.java index 2225b0699..9015f9d6a 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3AssembledDecompileTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/as3decompile/ActionScript3AssembledDecompileTest.java @@ -154,6 +154,25 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT false); } + @Test + public void testMutatingSwitch() { + decompileMethod("assembled", "testMutatingSwitch", "switch(this.k)\r\n" + + "{\r\n" + + "case \"a\":\r\n" + + "trace(\"A\");\r\n" + + "return;\r\n" + + "case \"b\":\r\n" + + "trace(\"B\");\r\n" + + "return;\r\n" + + "case \"c\":\r\n" + + "trace(\"C\");\r\n" + + "return;\r\n" + + "default:\r\n" + + "return;\r\n" + + "}\r\n", + false); + } + @Test public void testPushWhile() { decompileMethod("assembled", "testPushWhile", "var _loc3_:int = 5;\r\n" diff --git a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.abc b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.abc index 95ce67e5c..12597eff2 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.abc and b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.abc differ diff --git a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.asasm b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.asasm index 19061f329..a5f471b2d 100644 --- a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.asasm +++ b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/as3_assembled-0.main.asasm @@ -31,5 +31,6 @@ program #include "tests/TestPushWhile.script.asasm" #include "tests/TestActivationProps.script.asasm" #include "tests/TestSwapAssignment.script.asasm" + #include "tests/TestMutatingSwitch.script.asasm" ; place to add next end ; program diff --git a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.class.asasm b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.class.asasm new file mode 100644 index 000000000..a41076954 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.class.asasm @@ -0,0 +1,118 @@ +class + refid "tests:TestMutatingSwitch" + instance QName(PackageNamespace("tests"), "TestMutatingSwitch") + extends QName(PackageNamespace(""), "Object") + flag SEALED + flag PROTECTEDNS + protectedns ProtectedNamespace("tests:TestMutatingSwitch") + iinit + refid "tests:TestMutatingSwitch/instance/init" + body + maxstack 1 + localcount 1 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + + getlocal0 + constructsuper 0 + + returnvoid + end ; code + end ; body + end ; method + trait method QName(PackageNamespace(""), "run") + method + refid "tests:TestMutatingSwitch/instance/run" + returns QName(PackageNamespace(""), "void") + body + maxstack 2 + localcount 4 + initscopedepth 4 + maxscopedepth 5 + code + getlocal0 + pushscope + jump ofs0028 + ofs0006: + label + findpropstrict Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]) + pushstring "A" + callpropvoid Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]), 1 + returnvoid + ofs000f: + label + findpropstrict Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]) + pushstring "B" + callpropvoid Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]), 1 + returnvoid + ofs0018: + label + findpropstrict Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]) + pushstring "C" + callpropvoid Multiname("trace",[PackageNamespace(""),Namespace("http://adobe.com/AS3/2006/builtin"),PackageInternalNs(""),PrivateNamespace("MyClass"),ProtectedNamespace("MyClass"),StaticProtectedNs("MyClass"),PrivateNamespace("MyClass.as$0")]), 1 + returnvoid + ofs0021: + label + returnvoid + ofs0023: + label + jump ofs0076 + ofs0028: + getlocal0 + getproperty QName(PackageInternalNs(""),"k") + setlocal1 + pushstring "a" + getlocal1 + ifstrictne ofs0039 + pushbyte 0 + jump ofs0063 + ofs0039: + pushstring "b" + getlocal1 + ifstricteq ofs0044 ; here is stricteq instead of neq + jump ofs004a + ofs0044: + pushbyte 1 + jump ofs0063 + ofs004a: + pushstring "c" + getlocal1 + ifstrictne ofs0057 + pushbyte 2 + jump ofs0063 + ofs0057: + jump ofs0061 + pushbyte 3 + jump ofs0061 + ofs0061: + pushbyte 3 + ofs0063: + kill 1 + lookupswitch ofs0023, [ofs0006, ofs000f, ofs0018, ofs0021] + ofs0076: + returnvoid + + end ; code + end ; body + end ; method + end ; trait + end ; instance + cinit + refid "tests:TestMutatingSwitch/class/init" + body + maxstack 1 + localcount 1 + initscopedepth 3 + maxscopedepth 4 + code + getlocal0 + pushscope + + returnvoid + end ; code + end ; body + end ; method +end ; class diff --git a/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.script.asasm b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.script.asasm new file mode 100644 index 000000000..8d62cb908 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_assembled/abc/as3_assembled-0/tests/TestMutatingSwitch.script.asasm @@ -0,0 +1,29 @@ +script + sinit + refid "tests:TestMutatingSwitch/init" + body + maxstack 2 + localcount 1 + initscopedepth 1 + maxscopedepth 3 + code + getlocal0 + pushscope + + findpropstrict Multiname("TestMutatingSwitch", [PackageNamespace("tests")]) + getlex QName(PackageNamespace(""), "Object") + pushscope + + getlex Multiname("Object", [PrivateNamespace(null, "tests:TestMutatingSwitch"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")]) + newclass "tests:TestMutatingSwitch" + popscope + initproperty QName(PackageNamespace("tests"), "TestMutatingSwitch") + + returnvoid + end ; code + end ; body + end ; method + trait class QName(PackageNamespace("tests"), "TestMutatingSwitch") + #include "TestMutatingSwitch.class.asasm" + end ; trait +end ; script diff --git a/libsrc/ffdec_lib/testdata/as3_assembled/bin/as3_assembled.swf b/libsrc/ffdec_lib/testdata/as3_assembled/bin/as3_assembled.swf index a0b2c869d..72ba76281 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_assembled/bin/as3_assembled.swf and b/libsrc/ffdec_lib/testdata/as3_assembled/bin/as3_assembled.swf differ diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index ca95797dd..d236517e8 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2023 JPEXS - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */