mirror of
https://github.com/janet-lang/janet
synced 2025-06-21 07:54:12 +00:00
Fix debugger example.
This commit is contained in:
parent
94b472df64
commit
8cc43ad2d1
@ -69,14 +69,14 @@
|
|||||||
(var last-loc [-2 -2])
|
(var last-loc [-2 -2])
|
||||||
(print "\n function: " (dasm 'name) " [" (in dasm 'source "") "]")
|
(print "\n function: " (dasm 'name) " [" (in dasm 'source "") "]")
|
||||||
(when-let [constants (dasm 'constants)]
|
(when-let [constants (dasm 'constants)]
|
||||||
(printf " constants: %.4Q\n" constants))
|
(printf " constants: %.4Q" constants))
|
||||||
(printf " slots: %.4Q\n\n" (frame :slots))
|
(printf " slots: %.4Q\n" (frame :slots))
|
||||||
(def padding (string/repeat " " 20))
|
(def padding (string/repeat " " 20))
|
||||||
(loop [i :range [0 (length bytecode)]
|
(loop [i :range [0 (length bytecode)]
|
||||||
:let [instr (bytecode i)]]
|
:let [instr (bytecode i)]]
|
||||||
(prin (if (= (tuple/type instr) :brackets) "*" " "))
|
(prin (if (= (tuple/type instr) :brackets) "*" " "))
|
||||||
(prin (if (= i pc) "> " " "))
|
(prin (if (= i pc) "> " " "))
|
||||||
(printf "\e[33m%.20s\e[0m" (string (string/join (map string instr) " ") padding))
|
(prinf "\e[33m%.20s\e[0m" (string (string/join (map string instr) " ") padding))
|
||||||
(when sourcemap
|
(when sourcemap
|
||||||
(let [[sl sc] (sourcemap i)
|
(let [[sl sc] (sourcemap i)
|
||||||
loc [sl sc]]
|
loc [sl sc]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user