Fixed #1940 AS3 decompilation - wrong assignment

This commit is contained in:
Jindra Petřík
2023-01-29 12:22:09 +01:00
parent d9e8291178
commit 6f4cb4a8d6
17 changed files with 344 additions and 23 deletions

View File

@@ -30,5 +30,6 @@ program
#include "tests/TestTryWhile.script.asasm"
#include "tests/TestPushWhile.script.asasm"
#include "tests/TestActivationProps.script.asasm"
#include "tests/TestSwapAssignment.script.asasm"
; place to add next
end ; program

View File

@@ -0,0 +1,75 @@
class
refid "tests:TestSwapAssignment"
instance QName(PackageNamespace("tests"), "TestSwapAssignment")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestSwapAssignment")
iinit
refid "tests:TestSwapAssignment/instance/init"
body
maxstack 1
localcount 1
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
getlocal0
constructsuper 0
returnvoid
end ; code
end ; body
end ; method
trait method QName(PackageNamespace(""), "run")
method
refid "tests:TestSwapAssignment/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
getlex QName(PackageNamespace("mypkg"),"MyFactory")
callproperty QName(PackageNamespace(""),"createBitmap"), 0
coerce QName(PackageNamespace("flash.display"),"Bitmap")
dup
setlocal 6
getproperty QName(PackageNamespace(""),"x")
pushbyte 5
add
getlocal 6
swap
setproperty QName(PackageNamespace(""),"x")
getlocal 6
pushbyte -10
setproperty QName(PackageNamespace(""),"y")
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestSwapAssignment/class/init"
body
maxstack 1
localcount 1
initscopedepth 3
maxscopedepth 4
code
getlocal0
pushscope
returnvoid
end ; code
end ; body
end ; method
end ; class

View File

@@ -0,0 +1,29 @@
script
sinit
refid "tests:TestSwapAssignment/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestSwapAssignment", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestSwapAssignment"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestSwapAssignment"
popscope
initproperty QName(PackageNamespace("tests"), "TestSwapAssignment")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestSwapAssignment")
#include "TestSwapAssignment.class.asasm"
end ; trait
end ; script

View File

@@ -38,6 +38,7 @@ package
TestDoWhile2;
TestDoWhile3;
TestDoWhile4;
TestExecutionOrder;
TestExpressions;
TestFinallyZeroJump;
TestFor;

View File

@@ -0,0 +1,23 @@
package tests
{
public class TestExecutionOrder
{
public function run():*
{
var m:MyClass;
m.x = (m = create() as MyClass).x + 5;
trace(m.x);
}
private static function create(): Object {
return new MyClass();
}
}
}
class MyClass {
public var x:int = 1;
public var y:int = 1;
}