#349 AS3 - better handling of declarations

This commit is contained in:
Jindra Petřík
2021-02-04 21:36:09 +01:00
parent 041decaab1
commit 9c6b46ba79
28 changed files with 397 additions and 105 deletions

View File

@@ -16,5 +16,6 @@ program
#include "tests/TestDup.script.asasm"
#include "tests/TestSwitchDefault.script.asasm"
#include "tests/TestSwitch.script.asasm"
#include "tests/TestDeclareReg.script.asasm"
; place to add next
end ; program

View File

@@ -0,0 +1,76 @@
class
refid "tests:TestDeclareReg"
instance QName(PackageNamespace("tests"), "TestDeclareReg")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestDeclareReg")
iinit
refid "tests:TestDeclareReg/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:TestDeclareReg/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
localcount 4
initscopedepth 4
maxscopedepth 5
code
getlocal0
pushscope
newactivation
dup
setlocal2
pushscope
getscopeobject 1
getslot 1
dup
setlocal3
pushwith
findpropstrict QName(PackageNamespace(""),"trace")
pushstring "hey"
callpropvoid QName(PackageNamespace(""),"trace"), 1
popscope
returnvoid
end ; code
trait slot QName(PackageInternalNs("something"),"other")
slotid 1
type QName(PackageNamespace(""),"XML")
end ; trait
end ; body
end ; method
end ; trait
end ; instance
cinit
refid "tests:TestDeclareReg/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:TestDeclareReg/init"
body
maxstack 2
localcount 1
initscopedepth 1
maxscopedepth 3
code
getlocal0
pushscope
findpropstrict Multiname("TestDeclareReg", [PackageNamespace("tests")])
getlex QName(PackageNamespace(""), "Object")
pushscope
getlex Multiname("Object", [PrivateNamespace(null, "tests:TestDeclareReg"), PackageNamespace(""), PackageNamespace("tests"), PackageInternalNs("tests"), Namespace("http://adobe.com/AS3/2006/builtin")])
newclass "tests:TestDeclareReg"
popscope
initproperty QName(PackageNamespace("tests"), "TestDeclareReg")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestDeclareReg")
#include "TestDeclareReg.class.asasm"
end ; trait
end ; script