increments/decrements, chained assignments fixes

This commit is contained in:
Jindra Petřík
2021-01-27 10:09:11 +01:00
parent 9417978be4
commit 4dc28cdebe
24 changed files with 565 additions and 49 deletions

View File

@@ -6,5 +6,9 @@ program
#include "Main.script.asasm"
#include "tests/TestDupAssignment.script.asasm"
#include "tests/TestIncrement.script.asasm"
#include "tests/TestForEach.script.asasm"
#include "tests/TestForEachCoerced.script.asasm"
#include "tests/TestIncrement2.script.asasm"
#include "tests/TestSetSlotDup.script.asasm"
; place to add next
end ; program

View File

@@ -0,0 +1,86 @@
class
refid "tests:TestForEach"
instance QName(PackageNamespace("tests"), "TestForEach")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestForEach")
iinit
refid "tests:TestForEach/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:TestForEach/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
pushundefined
setlocal 5
pushbyte 0
setlocal2
pushbyte 0
setlocal3
pushbyte 0
setlocal 7
getlocal 5
setlocal 6
jump ofs0043
ofs0017:
label
getlocal 6
getlocal 7
nextvalue
dup
setlocal 4
pushnull
ifeq ofs0043
getlocal 4
setlocal2
ofs0043:
hasnext2 6, 7
iftrue ofs0017
pushbyte 0
setlocal3
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestForEach/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:TestForEach/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestForEach", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestForEach"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestForEach"
popscope
initproperty QName(PackageNamespace("tests"), "TestForEach")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestForEach")
#include "TestForEach.class.asasm"
end ; trait
end ; script

View File

@@ -0,0 +1,80 @@
class
refid "tests:TestForEachCoerced"
instance QName(PackageNamespace("tests"), "TestForEachCoerced")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestForEachCoerced")
iinit
refid "tests:TestForEachCoerced/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:TestForEachCoerced/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
pushbyte 0
setlocal 8
getlex QName(PrivateNamespace("somens"),"someprop")
setlocal 7
jump ofs0054
ofs0042:
label
getlocal 7
getlocal 8
nextvalue
coerce QName(PackageNamespace("somens"),"SomeClass")
dup
setlocal 6
getlocal1
getlocal2
getlocal 5
callpropvoid QName(Namespace("somens"),"methodname"), 3
ofs0054:
hasnext2 7, 8
iftrue ofs0042
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestForEachCoerced/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:TestForEachCoerced/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestForEachCoerced", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestForEachCoerced"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestForEachCoerced"
popscope
initproperty QName(PackageNamespace("tests"), "TestForEachCoerced")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestForEachCoerced")
#include "TestForEachCoerced.class.asasm"
end ; trait
end ; script

View File

@@ -0,0 +1,75 @@
class
refid "tests:TestIncrement2"
instance QName(PackageNamespace("tests"), "TestIncrement2")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestIncrement2")
iinit
refid "tests:TestIncrement2/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:TestIncrement2/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
getlocal0
pushscope
getlex QName(PrivateNamespace("somens"),"loadCount")
increment
dup
findpropstrict QName(PrivateNamespace("somens"),"loadCount")
swap
setproperty QName(PrivateNamespace("somens"),"loadCount")
pushbyte 2
ifne ofs001b
findpropstrict QName(ProtectedNamespace("somens"),"somemethod")
callpropvoid QName(ProtectedNamespace("somens"),"somemethod"), 0
ofs001b:
returnvoid
returnvoid
end ; code
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestIncrement2/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:TestIncrement2/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestIncrement2", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestIncrement2"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestIncrement2"
popscope
initproperty QName(PackageNamespace("tests"), "TestIncrement2")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestIncrement2")
#include "TestIncrement2.class.asasm"
end ; trait
end ; script

View File

@@ -0,0 +1,83 @@
class
refid "tests:TestSetSlotDup"
instance QName(PackageNamespace("tests"), "TestSetSlotDup")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestSetSlotDup")
iinit
refid "tests:TestSetSlotDup/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:TestSetSlotDup/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
newactivation
dup
setlocal1
pushscope
pushbyte 5
setlocal 5
getlex QName(PackageInternalNs("myns"),"myname")
pushstring "okay"
getlocal 5
dup
coerce QName(PackageNamespace(""),"int")
getlocal1
swap
setslot 1
callpropvoid QName(PackageNamespace(""),"somemethod"), 2
getlex QName(PackageInternalNs("myns"),"myname")
callpropvoid QName(PackageNamespace(""),"start"), 0
returnvoid
end ; code
trait slot QName(PackageInternalNs("myns"),"myslot")
slotid 1
type QName(PackageNamespace(""),"int")
;value Undefined()
end ; trait
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestSetSlotDup/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:TestSetSlotDup/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestSetSlotDup", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestSetSlotDup"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestSetSlotDup"
popscope
initproperty QName(PackageNamespace("tests"), "TestSetSlotDup")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestSetSlotDup")
#include "TestSetSlotDup.class.asasm"
end ; trait
end ; script

Binary file not shown.