fixed some dup problems

This commit is contained in:
Jindra Petřík
2021-01-27 19:11:31 +01:00
parent 97c325eb20
commit 2bebbfad0b
21 changed files with 644 additions and 76 deletions

View File

@@ -1573,6 +1573,19 @@ public class ActionScript3Test extends ActionScriptTestBase {
false);
}
@Test
public void testAssembledDoubleDup() {
decompileMethod("assembled", "testDoubleDup", "var _loc10_:Rectangle = myprop(_loc5_);\r\n"
+ "_loc10_.mymethod(-_loc10_.width,-_loc10_.height);\r\n",
false);
}
@Test
public void testAssembledDup() {
decompileMethod("assembled", "testDup", "return 1 - (var _loc1_:Number = 1 - _loc1_ / _loc4_) * _loc1_;\r\n",
false);
}
@Test
public void testAssembledDupAssignment() {
decompileMethod("assembled", "testDupAssignment", "var _loc1_:int = 0;\r\n"
@@ -1625,6 +1638,12 @@ public class ActionScript3Test extends ActionScriptTestBase {
false);
}
@Test
public void testAssembledIncrement3() {
decompileMethod("assembled", "testIncrement3", "_loc1_.length--;\r\n",
false);
}
@Test
public void testAssembledSetSlotDup() {
decompileMethod("assembled", "testSetSlotDup", "var _loc5_:int = 5;\r\n"
@@ -1633,6 +1652,12 @@ public class ActionScript3Test extends ActionScriptTestBase {
false);
}
@Test
public void testAssembledSetSlotFindProperty() {
decompileMethod("assembled", "testSetSlotFindProperty", "return var myprop:int = 50;\r\n",
false);
}
@Test
public void testOptionalParameters() {
String methodName = "testOptionalParameters";

View File

@@ -38,6 +38,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -120,7 +121,7 @@ public class AS3Generator {
useFile(s, new File("testdata/flashdevelop/bin/flashdevelop.swf"), "standard");
useFile(s, new File("testdata/custom/bin/custom.swf"), "assembled");
try (PrintWriter pw = new PrintWriter("as3_teststub.java")) {
try (PrintWriter pw = new PrintWriter("as3_teststub.java", Charset.forName("UTF-8"))) {
pw.println(s.toString());
}
System.exit(0);