Fixed #1206 Switch with multiple default clauses

Fixed switch(null) in some cases
This commit is contained in:
Jindra Petřík
2021-01-28 09:40:06 +01:00
parent f6f355f0af
commit 1c981b9c13
10 changed files with 329 additions and 321 deletions

View File

@@ -14,6 +14,6 @@ program
#include "tests/TestDoubleDup.script.asasm"
#include "tests/TestIncrement3.script.asasm"
#include "tests/TestDup.script.asasm"
#include "tests/TestDup2.script.asasm"
#include "tests/TestSwitchDefault.script.asasm"
; place to add next
end ; program

View File

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

View File

@@ -1,12 +1,12 @@
class
refid "tests:TestDup2"
instance QName(PackageNamespace("tests"), "TestDup2")
refid "tests:TestSwitchDefault"
instance QName(PackageNamespace("tests"), "TestSwitchDefault")
extends QName(PackageNamespace(""), "Object")
flag SEALED
flag PROTECTEDNS
protectedns ProtectedNamespace("tests:TestDup2")
protectedns ProtectedNamespace("tests:TestSwitchDefault")
iinit
refid "tests:TestDup2/instance/init"
refid "tests:TestSwitchDefault/instance/init"
body
maxstack 1
localcount 1
@@ -25,7 +25,7 @@ class
end ; method
trait method QName(PackageNamespace(""), "run")
method
refid "tests:TestDup2/instance/run"
refid "tests:TestSwitchDefault/instance/run"
returns QName(PackageNamespace(""), "void")
body
maxstack 2
@@ -35,14 +35,34 @@ class
code
getlocal0
pushscope
getlocal3
getproperty QName(PackageNamespace(""),"myprop")
dup
getlocal1
getproperty MultinameL([PrivateNamespace("somens")])
swap
call 0
pop
pushbyte 5
lookupswitch Ldef, [L0,L1,Ldef,L3,Ldef,L5,L6]
Ldef:
pushbyte 100
setlocal2
jump Lbr
L0:
pushbyte 0
setlocal2
jump Lbr
L1:
pushbyte 1
setlocal2
jump L5
L3:
pushbyte 3
setlocal2
jump Lbr
L5:
pushbyte 5
setlocal2
jump Lbr
L6:
pushbyte 6
setlocal2
jump L0
Lbr:
returnvoid
end ; code
end ; body
@@ -50,7 +70,7 @@ class
end ; trait
end ; instance
cinit
refid "tests:TestDup2/class/init"
refid "tests:TestSwitchDefault/class/init"
body
maxstack 1
localcount 1

View File

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

Binary file not shown.