Fixed: AS3 getslot/setslot, getglobalscope instruction

This commit is contained in:
Jindra Petřík
2021-02-09 22:15:12 +01:00
parent 485dabc2d2
commit fcd39050b7
34 changed files with 473 additions and 178 deletions

View File

@@ -23,5 +23,7 @@ program
#include "tests/TestDeobfuscatorJumpsExceptionStart.script.asasm"
#include "tests/TestUnnamedException.script.asasm"
#include "tests/TestTryCatchLoopBreakLevel2.script.asasm"
#include "tests/TestSlots.script.asasm"
#include "tests/TestSlots.init/inline_method.method.asasm"
; place to add next
end ; program

View File

@@ -0,0 +1,163 @@
class
refid "tests:TestSlots"
instance QName(PackageNamespace("tests"), "TestSlots")
extends QName(PackageNamespace(""), "Object")
flag SEALED
iinit
refid "tests:TestSlots/instance/init"
body
maxstack 1
localcount 1
initscopedepth 0
maxscopedepth 1
code
getlocal0
pushscope
getlocal0
constructsuper 0
returnvoid
end ; code
end ; body
end ; method
trait slot QName(PackageNamespace(""), "instanceVar1") flag METADATA type QName(PackageNamespace(""), "String") value Utf8("ins1")
slotid 1
metadata "__go_to_definition_help"
item "pos" "106"
end ; metadata
end ; trait
trait slot QName(PackageNamespace(""), "instanceVar2") flag METADATA type QName(PackageNamespace(""), "String") value Utf8("ins2")
slotid 2
metadata "__go_to_definition_help"
item "pos" "150"
end ; metadata
end ; trait
trait method QName(PackageNamespace(""), "instanceMethod") flag METADATA
method
name "instanceMethod"
refid "tests:TestSlots/instance/instanceMethod"
returns QName(PackageNamespace(""), "void")
body
maxstack 3
localcount 1
initscopedepth 0
maxscopedepth 1
code
getlocal0
pushscope
debugfile "C:\\Dropbox\\Programovani\\JavaSE\\FFDec\\libsrc\\ffdec_lib\\testdata\\testslots\\src;tests;TestSlots.as"
findpropstrict QName(PackageNamespace(""), "trace")
debugline 18
getscopeobject 0
getslot 1 ;instanceVar1
callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 19
getscopeobject 0
getslot 2 ;instanceVar2
callpropvoid QName(PackageNamespace(""), "trace"), 1
;these are nested, I think this won't happen in real files
;findpropstrict QName(PackageNamespace(""), "trace")
;debugline 20
;getglobalscope
;getslot 3 ;TestSlots
;getslot 1 ;classVar1
;callpropvoid QName(PackageNamespace(""), "trace"), 1
;findpropstrict QName(PackageNamespace(""), "trace")
;debugline 21
;getglobalscope
;getslot 3 ;TestSlots
;getslot 2 ;classVar2
;callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 22
getglobalscope
getslot 1 ;globalVar1
callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 23
getglobalscope
getslot 2 ;globalVar2
callpropvoid QName(PackageNamespace(""), "trace"), 1
returnvoid
end ; code
end ; body
end ; method
metadata "__go_to_definition_help"
item "pos" "309"
end ; metadata
end ; trait
end ; instance
cinit
refid "tests:TestSlots/class/init"
body
maxstack 0
localcount 1
initscopedepth 0
maxscopedepth 0
code
returnvoid
end ; code
end ; body
end ; method
trait slot QName(PackageNamespace(""), "classVar1") flag METADATA type QName(PackageNamespace(""), "String") value Utf8("cls1")
slotid 1
metadata "__go_to_definition_help"
item "pos" "205"
end ; metadata
end ; trait
trait slot QName(PackageNamespace(""), "classVar2") flag METADATA type QName(PackageNamespace(""), "String") value Utf8("cls2")
slotid 2
metadata "__go_to_definition_help"
item "pos" "254"
end ; metadata
end ; trait
trait method QName(PackageNamespace(""), "classMethod") flag METADATA
method
name "classMethod"
refid "tests:TestSlots/class/classMethod"
returns QName(PackageNamespace(""), "void")
body
maxstack 3
localcount 1
initscopedepth 0
maxscopedepth 1
code
getlocal0
pushscope
debugfile "C:\\Dropbox\\Programovani\\JavaSE\\FFDec\\libsrc\\ffdec_lib\\testdata\\testslots\\src;tests;TestSlots.as"
findpropstrict QName(PackageNamespace(""), "trace")
debugline 28
getscopeobject 0
getslot 1 ;classVar1
callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 29
getscopeobject 0
getslot 2 ;classVar2
callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 30
getglobalscope
getslot 1 ;globalVar1
callpropvoid QName(PackageNamespace(""), "trace"), 1
findpropstrict QName(PackageNamespace(""), "trace")
debugline 31
getglobalscope
getslot 2 ;globalVar2
callpropvoid QName(PackageNamespace(""), "trace"), 1
returnvoid
end ; code
end ; body
end ; method
metadata "__go_to_definition_help"
item "pos" "512"
end ; metadata
end ; trait
end ; class

View File

@@ -0,0 +1,29 @@
method
name "globalFunction"
refid "tests:TestSlots/init/inline_method"
returns QName(PackageNamespace(""), "void")
body
maxstack 3
localcount 1
initscopedepth 0
maxscopedepth 1
code
getlocal0
pushscope
debugfile "C:\\Dropbox\\Programovani\\JavaSE\\FFDec\\libsrc\\ffdec_lib\\testdata\\testslots\\src;tests;TestSlots.as"
getlex QName(PackageNamespace(""), "trace")
debugline 43
getglobalscope
getlex QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar1")
call 1
pop
getlex QName(PackageNamespace(""), "trace")
debugline 44
getglobalscope
getlex QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar2")
call 1
returnvoid
end ; code
end ; body
end ; method

View File

@@ -0,0 +1,57 @@
script
sinit
refid "tests:TestSlots/init"
body
maxstack 3
localcount 1
initscopedepth 0
maxscopedepth 2
code
getlocal0
pushscope
getscopeobject 0
getlex QName(PackageNamespace(""), "Object")
dup
pushscope
newclass "tests:TestSlots"
popscope
initproperty QName(PackageNamespace("tests"), "TestSlots")
getglobalscope
newfunction "tests:TestSlots/init/inline_method"
setproperty QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalFunction")
debugfile "C:\\Dropbox\\Programovani\\JavaSE\\FFDec\\libsrc\\ffdec_lib\\testdata\\testslots\\src;tests;TestSlots.as"
debugline 38
pushstring "glb1"
findproperty QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar1")
swap
setproperty QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar1")
debugline 39
pushstring "glb2"
findproperty QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar2")
swap
setproperty QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar2")
returnvoid
end ; code
end ; body
end ; method
trait class QName(PackageNamespace("tests"), "TestSlots") flag METADATA
slotid 3
#include "TestSlots.class.asasm"
metadata "__go_to_definition_help"
item "pos" "73"
end ; metadata
end ; trait
trait slot QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar1") type QName(PackageNamespace(""), "String")
slotid 1
end
trait slot QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalVar2") type QName(PackageNamespace(""), "String")
slotid 2
end
trait slot QName(PrivateNamespace("FilePrivateNS:TestSlots"), "globalFunction") end
end ; script

View File

@@ -3,6 +3,8 @@
<!--Any modifications you make may be lost.-->
<flex-config>
<target-player>25.0</target-player>
<benchmark>false</benchmark>
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler>
<define append="true">
<name>CONFIG::debug</name>

View File

@@ -23,14 +23,16 @@ package tests
{
trace("in catch1");
while (true){
trace("xx");
if (a > 5){
break;
}
trace("yy");
}
trace("in catch1c");
}
}
trace("after");
//trace("after");
}