diff --git a/CHANGELOG.md b/CHANGELOG.md index dd93eaaa3..da9ab01f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] +### Fixed +- [#1761] AS3 - try..finally inside another structure like if + ## [15.0.0] - 2021-11-29 ### Added - Frame dependencies @@ -2194,6 +2198,10 @@ All notable changes to this project will be documented in this file. ### Added - Initial public release +[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version15.0.0...dev +[15.0.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.6.0...version15.0.0 +[14.6.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.5.2...version14.6.0 +[14.5.2]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.5.1...version14.5.2 [14.5.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.5.0...version14.5.1 [14.5.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.4.0...version14.5.0 [14.4.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.1...version14.4.0 @@ -2309,6 +2317,7 @@ All notable changes to this project will be documented in this file. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#1761]: https://www.free-decompiler.com/flash/issues/1761 [#1750]: https://www.free-decompiler.com/flash/issues/1750 [#1485]: https://www.free-decompiler.com/flash/issues/1485 [#1681]: https://www.free-decompiler.com/flash/issues/1681 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index b8d1e7785..061c21b77 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -462,15 +462,17 @@ public class AVM2Graph extends Graph { } } - //return in finally block is joined after switch decision - for (GraphPart p : switchPart.nextParts) { + //This caused problems, so it's commented out + //the tests still pass, so I can only wonder why it's there. :-( + //return in finally block is joined after switch decision + /*for (GraphPart p : switchPart.nextParts) { for (GraphPart r : p.refs) { if (r != switchPart) { localData.finallyJumps.put(r, p); localData.finallyJumpsToFinallyIndex.put(r, e); } } - } + }*/ localData.ignoredSwitches.put(e, switchPart); } else { diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DecompileTestBase.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DecompileTestBase.java index b21478dcc..5a7ab35d3 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DecompileTestBase.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DecompileTestBase.java @@ -89,9 +89,9 @@ public abstract class ActionScript3DecompileTestBase extends ActionScriptTestBas try { List ts = new ArrayList<>(); ts.add(abc.instance_info.get(clsIndex).instance_traits); - - Configuration.autoDeobfuscate.set(methodName.toLowerCase().contains("obfus")); - + + Configuration.autoDeobfuscate.set(methodName.toLowerCase().contains("obfus")); + abc.bodies.get(bodyIndex).convert(new ConvertData(), "run", ScriptExportMode.AS, isStatic, abc.bodies.get(bodyIndex).method_info, scriptIndex, clsIndex, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true, new HashSet<>()); writer = new HighlightedTextWriter(new CodeFormatting(), false); abc.bodies.get(bodyIndex).toString("run", ScriptExportMode.AS, abc, null, writer, new ArrayList<>(), new HashSet<>()); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java index ca29543b3..f15a9c3f0 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3OptinalParametersTest.java @@ -23,6 +23,7 @@ public class ActionScript3OptinalParametersTest extends ActionScript3DecompileTe public void init() throws IOException, InterruptedException { addSwf("standard", "testdata/as3_new/bin/as3_new.flex.swf"); } + @Test public void testOptionalParameters() { String methodName = "testOptionalParameters"; diff --git a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf index 2ee129cef..ca1dca326 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf and b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.air.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf index 5077763ec..fd277cc1a 100644 Binary files a/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf and b/libsrc/ffdec_lib/testdata/as3_new/bin/as3_new.flex.swf differ diff --git a/libsrc/ffdec_lib/testdata/as3_new/obj/as3_newConfig.xml b/libsrc/ffdec_lib/testdata/as3_new/obj/as3_newConfig.xml index 48bbe0213..b738e8b3a 100644 --- a/libsrc/ffdec_lib/testdata/as3_new/obj/as3_newConfig.xml +++ b/libsrc/ffdec_lib/testdata/as3_new/obj/as3_newConfig.xml @@ -16,7 +16,7 @@ CONFIG::timeStamp - '13.03.2021' + '30.11.2021' CONFIG::air diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/Main.as b/libsrc/ffdec_lib/testdata/as3_new/src/Main.as index 9f8881045..20225e702 100644 --- a/libsrc/ffdec_lib/testdata/as3_new/src/Main.as +++ b/libsrc/ffdec_lib/testdata/as3_new/src/Main.as @@ -58,6 +58,7 @@ package TestHello; TestIf; TestIfElse; + TestIfFinally; TestIfInIf; TestIfTry; TestIgnoreAndOr; diff --git a/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIfFinally.as b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIfFinally.as new file mode 100644 index 000000000..93a515c6c --- /dev/null +++ b/libsrc/ffdec_lib/testdata/as3_new/src/tests/TestIfFinally.as @@ -0,0 +1,26 @@ +package tests +{ + + public class TestIfFinally + { + public function run():* + { + var a:int = Math.random(); + if (a == 5) + { + try + { + trace("in try body"); + } + catch (e:Error) + { + trace("in catch"); + } + finally + { + trace("in finally"); + } + } + } + } +}