Fixed #1761 AS3 - try..finally inside another structure like if

This commit is contained in:
Jindra Petřík
2021-11-30 07:13:32 +01:00
parent fd3e3eec61
commit f1ab87f2b7
9 changed files with 46 additions and 7 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -89,9 +89,9 @@ public abstract class ActionScript3DecompileTestBase extends ActionScriptTestBas
try {
List<Traits> 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<>());

View File

@@ -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";

View File

@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
<value>'13.03.2021'</value>
<value>'30.11.2021'</value>
</define>
<define append="true">
<name>CONFIG::air</name>

View File

@@ -58,6 +58,7 @@ package
TestHello;
TestIf;
TestIfElse;
TestIfFinally;
TestIfInIf;
TestIfTry;
TestIgnoreAndOr;

View File

@@ -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");
}
}
}
}
}