mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 15:32:15 +00:00
Fixed: AS3 break loop in catch clause
This commit is contained in:
@@ -230,6 +230,35 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchLoopBreakLevel2() {
|
||||
decompileMethod("assembled", "testTryCatchLoopBreakLevel2", "var a:int = 0;\r\n"
|
||||
+ "a = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "loop0:\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "while(a <= 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "if(a > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "break loop0;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryDoWhile() {
|
||||
decompileMethod("assembled", "testTryDoWhile", "trace(\"first\");\r\n"
|
||||
|
||||
@@ -311,6 +311,124 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchLoopBreak2(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchLoopBreak2", "var a:int = 0;\r\n"
|
||||
+ "a = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(a < 20)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "return;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch\");\r\n"
|
||||
+ "trace(\"a=\" + a);\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchLoopBreak3(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchLoopBreak3", "var a:int = 0;\r\n"
|
||||
+ "a = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:EOFError)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch2\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchLoopBreak4(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchLoopBreak4", "var a:int = 0;\r\n"
|
||||
+ "a = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "if(a > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"a\");\r\n"
|
||||
+ "if(a > 6)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"b\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1b\");\r\n"
|
||||
+ "if(a > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"d\");\r\n"
|
||||
+ "if(a > 11)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"e\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"f\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchLoopBreak5(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchLoopBreak5", "var a:int = 0;\r\n"
|
||||
+ "a = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "if(a > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchTry(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchTry", "trace(\"before try\");\r\n"
|
||||
|
||||
@@ -350,6 +350,76 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchLoopBreak4() {
|
||||
decompileMethod("swftools", "testTryCatchLoopBreak4", "var _loc1_:int = 0;\r\n"
|
||||
+ "_loc1_ = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "if(_loc1_ > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"a\");\r\n"
|
||||
+ "if(_loc1_ > 6)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"b\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1b\");\r\n"
|
||||
+ "if(_loc1_ > 10)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"d\");\r\n"
|
||||
+ "if(_loc1_ > 11)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"e\");\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"f\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchLoopBreak5() {
|
||||
decompileMethod("swftools", "testTryCatchLoopBreak5", "var _loc1_:int = 0;\r\n"
|
||||
+ "_loc1_ = 0;\r\n"
|
||||
+ "trace(\"before loop\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in catch1\");\r\n"
|
||||
+ "while(true)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "if(_loc1_ > 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "break;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"in catch1c\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchTry() {
|
||||
decompileMethod("swftools", "testTryCatchTry", "trace(\"before try\");\r\n"
|
||||
|
||||
Reference in New Issue
Block a user