Fixed: #2226 Incorrect decompilation of continue statements in some cases

This commit is contained in:
Jindra Petřík
2024-08-02 01:52:45 +02:00
parent de21cc3a7e
commit 31099c64e8
9 changed files with 191 additions and 101 deletions

View File

@@ -2226,6 +2226,36 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
false);
}
@Test
public void testWhileSwitch() {
decompileMethod("classic_air", "testWhileSwitch", "var a:Boolean = true;\r\n"
+ "var d:int = 5;\r\n"
+ "var e:Boolean = true;\r\n"
+ "var i:int = 0;\r\n"
+ "while(i < 100)\r\n"
+ "{\r\n"
+ "trace(\"start\");\r\n"
+ "if(a)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"
+ "}\r\n"
+ "else\r\n"
+ "{\r\n"
+ "switch(d - 1)\r\n"
+ "{\r\n"
+ "case 0:\r\n"
+ "trace(\"D1\");\r\n"
+ "}\r\n"
+ "}\r\n"
+ "if(e)\r\n"
+ "{\r\n"
+ "trace(\"E\");\r\n"
+ "}\r\n"
+ "i++;\r\n"
+ "}\r\n",
false);
}
@Test
public void testWhileTry() {
decompileMethod("classic_air", "testWhileTry", "while(true)\r\n"

View File

@@ -2219,6 +2219,36 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
false);
}
@Test
public void testWhileSwitch() {
decompileMethod("classic", "testWhileSwitch", "var a:Boolean = true;\r\n"
+ "var d:int = 5;\r\n"
+ "var e:Boolean = true;\r\n"
+ "var i:int = 0;\r\n"
+ "while(i < 100)\r\n"
+ "{\r\n"
+ "trace(\"start\");\r\n"
+ "if(a)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"
+ "}\r\n"
+ "else\r\n"
+ "{\r\n"
+ "switch(d)\r\n"
+ "{\r\n"
+ "case 1:\r\n"
+ "trace(\"D1\");\r\n"
+ "}\r\n"
+ "}\r\n"
+ "if(e)\r\n"
+ "{\r\n"
+ "trace(\"E\");\r\n"
+ "}\r\n"
+ "i++;\r\n"
+ "}\r\n",
false);
}
@Test
public void testWhileTry() {
decompileMethod("classic", "testWhileTry", "while(true)\r\n"