mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-07 11:58:44 +00:00
Fixed: AS3 with statement decompilation
This commit is contained in:
@@ -18,10 +18,8 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
|
||||
|
||||
@Test
|
||||
public void testDeclareReg() {
|
||||
decompileMethod("assembled", "testDeclareReg", "var _loc3_:*;\r\n"
|
||||
+ "with(_loc3_ = other)\r\n"
|
||||
decompileMethod("assembled", "testDeclareReg", "with(other)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "\r\n"
|
||||
+ "trace(\"hey\");\r\n"
|
||||
+ "}\r\n",
|
||||
false);
|
||||
|
||||
@@ -513,6 +513,28 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryCatchWith(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryCatchWith", "var a:MyTest = new MyTest();\r\n"
|
||||
+ "trace(\"before with\");\r\n"
|
||||
+ "with(a)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"before try\");\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "attrib = attrib + 1;\r\n"
|
||||
+ "trace(\"in catch\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "swfNamesProvider")
|
||||
public void testTryFinally(String swfUsed) {
|
||||
decompileMethod(swfUsed, "testTryFinally", "trace(\"before try\");\r\n"
|
||||
|
||||
@@ -504,6 +504,32 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryCatchWith() {
|
||||
decompileMethod("swftools", "testTryCatchWith", "var _loc1_:* = new MyTest();\r\n"
|
||||
+ "trace(\"before with\");\r\n"
|
||||
+ "var _loc2_:*;\r\n"
|
||||
+ "with(_loc2_ = _loc1_)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"before try\");\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"in try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "catch(e:Error)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "with(_loc2_)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "\r\n"
|
||||
+ "attrib = attrib + 1;\r\n"
|
||||
+ "trace(\"in catch\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after try\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "trace(\"after\");\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryFinally() {
|
||||
decompileMethod("swftools", "testTryFinally", "trace(\"before try\");\r\n"
|
||||
|
||||
Reference in New Issue
Block a user