1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-18 17:27:40 +00:00

initial slotsyms implementation

This commit is contained in:
Jona Ekenberg
2023-02-01 09:39:24 +01:00
parent dacbe29771
commit 88813c4f87
8 changed files with 162 additions and 1 deletions

27
test/suite0015.janet Normal file
View File

@@ -0,0 +1,27 @@
# test *debug* flags
(import ./helper :prefix "" :exit true)
(start-suite 15)
(assert (deep= (in (disasm (defn a [] (def x 10) x)) :slotsyms)
@[])
"no slotsyms when *debug* is false")
(setdyn *debug* true)
(assert (deep= (in (disasm (defn a [] (def x 10) x)) :slotsyms)
@[[:top :top @{"a" @[[0 0]] "x" @[[1 1]]}]])
"slotsyms when *debug* is true")
(setdyn *debug* false)
(setdyn *debug* true)
(assert (deep= (in (disasm (defn a []
(def x 10)
(do
(def y 20)
(+ x y)))) :slotsyms)
@[[:top :top @{"a" @[[0 0]] "x" @[[1 1]]}]
[2 5 @{"y" @[[2 2]]}]])
"inner slotsyms")
(setdyn *debug* false)
(end-suite)