mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 01:25:36 +00:00
Fixed: #2618 AS1/2 increment/decrement using PushDuplicate
This commit is contained in:
@@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file.
|
||||
- HTML5 Canvas morphshape export
|
||||
- Slovenian translation
|
||||
- [#2626] AS1/2 direct editation - function calls inside `with` statement
|
||||
- [#2618] AS1/2 increment/decrement using PushDuplicate
|
||||
|
||||
### Changed
|
||||
- [#2610] Export as SWF - take SWF bounds from the exported item bounds
|
||||
@@ -4108,6 +4109,7 @@ Major version of SWF to XML export changed to 2.
|
||||
[#2610]: https://www.free-decompiler.com/flash/issues/2610
|
||||
[#2603]: https://www.free-decompiler.com/flash/issues/2603
|
||||
[#2626]: https://www.free-decompiler.com/flash/issues/2626
|
||||
[#2618]: https://www.free-decompiler.com/flash/issues/2618
|
||||
[#2581]: https://www.free-decompiler.com/flash/issues/2581
|
||||
[#2592]: https://www.free-decompiler.com/flash/issues/2592
|
||||
[#2154]: https://www.free-decompiler.com/flash/issues/2154
|
||||
|
||||
@@ -105,8 +105,9 @@ public class ActionSetMember extends Action {
|
||||
|
||||
if (value instanceof IncrementActionItem) {
|
||||
if (((IncrementActionItem) value).object instanceof GetMemberActionItem) {
|
||||
if (((GetMemberActionItem) ((IncrementActionItem) value).object).object.equals(object)) {
|
||||
if (((GetMemberActionItem) ((IncrementActionItem) value).object).object.getThroughDuplicate().equals(object)) {
|
||||
if (((GetMemberActionItem) ((IncrementActionItem) value).object).memberName.equals(memberName)) {
|
||||
((GetMemberActionItem) ((IncrementActionItem) value).object).object = ((GetMemberActionItem) ((IncrementActionItem) value).object).object.getThroughDuplicate();
|
||||
output.add(new PostIncrementActionItem(this, lineStartAction, ((IncrementActionItem) value).object));
|
||||
return;
|
||||
}
|
||||
@@ -115,9 +116,10 @@ public class ActionSetMember extends Action {
|
||||
}
|
||||
if (value instanceof DecrementActionItem) {
|
||||
if (((DecrementActionItem) value).object instanceof GetMemberActionItem) {
|
||||
if (((GetMemberActionItem) ((DecrementActionItem) value).object).object.valueEquals(object)) {
|
||||
if (((GetMemberActionItem) ((DecrementActionItem) value).object).object.getThroughDuplicate().valueEquals(object)) {
|
||||
if (((GetMemberActionItem) ((DecrementActionItem) value).object).memberName.equals(memberName)) {
|
||||
output.add(new PostDecrementActionItem(this, lineStartAction, ((DecrementActionItem) value).object));
|
||||
((GetMemberActionItem) ((DecrementActionItem) value).object).object = ((GetMemberActionItem) ((DecrementActionItem) value).object).object.getThroughDuplicate();
|
||||
output.add(new PostDecrementActionItem(this, lineStartAction, ((DecrementActionItem) value).object.getThroughDuplicate()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,4 +572,19 @@ public class ActionScript2AssemblerTest extends ActionScript2TestBase {
|
||||
+ "}\n"
|
||||
+ "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrementDup() {
|
||||
String res = decompilePcode("Push \"this\"\n"
|
||||
+ "GetVariable\n"
|
||||
+ "PushDuplicate\n"
|
||||
+ "Push \"myVar\"\n"
|
||||
+ "GetMember\n"
|
||||
+ "Increment\n"
|
||||
+ "Push \"myVar\"\n"
|
||||
+ "StackSwap\n"
|
||||
+ "SetMember");
|
||||
res = cleanPCode(res);
|
||||
assertEquals(res, "this.myVar++;");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user