new for loop continues detection

This commit is contained in:
Jindra Petřík
2021-01-29 07:32:21 +01:00
parent f8f7d00981
commit bfe0fce888
14 changed files with 250 additions and 128 deletions

View File

@@ -2008,8 +2008,6 @@ public class ActionScript2Test extends ActionScript2TestBase {
+ "case \"C\":\r\n"
+ "trace(\"Ret 5\");\r\n"
+ "return 5;\r\n"
+ "default:\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n"
+ "trace(\"Final\");\r\n"

View File

@@ -251,10 +251,8 @@ public class ActionScript3Test extends ActionScriptTestBase {
+ "for(d = 0; d < 25; d++)\r\n"
+ "{\r\n"
+ "e = 0;\r\n"
+ "if(e >= 50)\r\n"
+ "if(e < 50)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "if(e == 9)\r\n"
+ "{\r\n"
+ "break;\r\n"
@@ -269,6 +267,7 @@ public class ActionScript3Test extends ActionScriptTestBase {
+ "}\r\n"
+ "break loop1;\r\n"
+ "}\r\n"
+ "}\r\n"
+ "trace(\"hello\");\r\n"
+ "}\r\n",
false);
@@ -1658,6 +1657,27 @@ public class ActionScript3Test extends ActionScriptTestBase {
false);
}
@Test
public void testAssembledSwitch() {
decompileMethod("assembled", "testSwitch", "switch(int(somevar))\r\n"
+ "{\r\n"
+ "case 0:\r\n"
+ "var _loc2_:String = \"X\";\r\n"
+ "return;\r\n"
+ "break;\r\n"
+ "case 1:\r\n"
+ "_loc2_ = \"A\";\r\n"
+ "break;\r\n"
+ "case 3:\r\n"
+ "_loc2_ = \"B\";\r\n"
+ "break;\r\n"
+ "case 4:\r\n"
+ "_loc2_ = \"C\";\r\n"
+ "}\r\n"
+ "_loc2_ = \"after\";\r\n",
false);
}
@Test
public void testAssembledSwitchDefault() {
decompileMethod("assembled", "testSwitchDefault", "switch(5)\r\n"

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.generators;
import com.jpexs.decompiler.flash.SWF;
@@ -90,12 +91,10 @@ public class AS2Generator {
s.append("}");
doa = null;
}
}
/*try (PrintWriter pw = new PrintWriter("as2_teststub.java")) {
pw.println(s.toString());
}*/
try (FileOutputStream fos = new FileOutputStream("as2_teststub.java")) {
fos.write(Utf8Helper.getBytes(s.toString()));
}
try (FileOutputStream fos = new FileOutputStream("as2_teststub.java")) {
fos.write(Utf8Helper.getBytes(s.toString()));
}
System.exit(0);
}
}