mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-07 02:58:43 +00:00
try in if fix
This commit is contained in:
@@ -1067,7 +1067,7 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
|
||||
if (afterPart == null && localData.pushDefaultPart.containsKey(finallyIndex)) {
|
||||
if (localData.pushDefaultPart.containsKey(finallyIndex)) {
|
||||
exAfterPart = localData.pushDefaultPart.get(finallyIndex);
|
||||
tryStopPart.add(exAfterPart);
|
||||
}
|
||||
|
||||
@@ -238,15 +238,14 @@ public class Graph {
|
||||
|
||||
GraphPartQueue newParts = new GraphPartQueue();
|
||||
List<GraphPart> nextParts = new ArrayList<>(getNextParts(localData, part));
|
||||
/*
|
||||
!!THROW
|
||||
|
||||
for (ThrowState ts : throwStates) {
|
||||
if (ts.state != 1) {
|
||||
if (ts.throwingParts.contains(part)) {
|
||||
newParts.add(ts.targetPart);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
loopnext:
|
||||
for (GraphPart nextRaw : nextParts) {
|
||||
|
||||
|
||||
@@ -94,6 +94,36 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchInIf2(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = Math.random();\r\n"
|
||||
+ "if(a > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"a\");\r\n"
|
||||
+ "return;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch 1\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "else\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"b\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch 2\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchInWhile(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchInWhile", "trace(\"before loop\");\r\n"
|
||||
|
||||
@@ -85,6 +85,36 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchInIf2() {
|
||||
decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:int = Math.random();\r\n"
|
||||
+ "if(_loc1_ > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"a\");\r\n"
|
||||
+ "return;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch 1\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "else\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"b\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch 2\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchInWhile() {
|
||||
decompileMethod("swftools", "testTryCatchInWhile", "trace(\"before loop\");\r\n"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,6 +13,7 @@ package
|
||||
TestTryCatch;
|
||||
TestTryCatchIfInTry;
|
||||
TestTryCatchInIf;
|
||||
TestTryCatchInIf2;
|
||||
TestTryCatchInWhile;
|
||||
TestTryCatchInWhile2;
|
||||
TestTryCatchInWhile3;
|
||||
|
||||
43
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as
vendored
Normal file
43
libsrc/ffdec_lib/testdata/as3_cross_compile/src/tests/TestTryCatchInIf2.as
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
/**
|
||||
* ...
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TestTryCatchInIf2
|
||||
{
|
||||
|
||||
public function run():void
|
||||
{
|
||||
var a:int = Math.random();
|
||||
|
||||
if (a > 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
trace("a");
|
||||
return;
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch 1");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
trace("b");
|
||||
}
|
||||
catch (e:Error)
|
||||
{
|
||||
trace("in catch 2");
|
||||
}
|
||||
}
|
||||
trace("after");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -5,7 +5,7 @@ package tests
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
trace("hello");
|
||||
trace("hello");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user