mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-22 15:16:29 +00:00
More AS1/2 increment,decrement,compound using PushDuplicate
This commit is contained in:
@@ -574,7 +574,7 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrementDup() {
|
||||
public void testMemberIncrementDup() {
|
||||
String res = decompilePcode("Push \"this\"\n"
|
||||
+ "GetVariable\n"
|
||||
+ "PushDuplicate\n"
|
||||
@@ -587,4 +587,45 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "this.myVar++;");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMemberCompoundDup() {
|
||||
String res = decompilePcode("Push \"this\"\n"
|
||||
+ "GetVariable\n"
|
||||
+ "PushDuplicate\n"
|
||||
+ "Push \"myVar\"\n"
|
||||
+ "GetMember\n"
|
||||
+ "Push 1\n"
|
||||
+ "Add2\n"
|
||||
+ "Push \"myVar\"\n"
|
||||
+ "StackSwap\n"
|
||||
+ "SetMember");
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "this.myVar += 1;");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testVariableIncrementDup() {
|
||||
String res = decompilePcode("Push \"c\"\n"
|
||||
+ "PushDuplicate\n"
|
||||
+ "GetVariable\n"
|
||||
+ "Increment\n"
|
||||
+ "SetVariable");
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "c++;");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariableCompoundDup() {
|
||||
String res = decompilePcode("Push \"c\"\n"
|
||||
+ "PushDuplicate\n"
|
||||
+ "GetVariable\n"
|
||||
+ "Push 1\n"
|
||||
+ "Add2\n"
|
||||
+ "SetVariable");
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "c += 1;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user