From dd458c8ab54ab57915b4acb13ff539ceb0734479 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Tue, 28 Apr 2020 23:04:24 -0500 Subject: [PATCH] Make JANET_NO_ASSEMBLER not break build. --- src/boot/boot.janet | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index f86b2c53..2f3c3e25 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -2375,12 +2375,15 @@ [&opt nth frame-idx] (in (.slots frame-idx) (or nth 0))) +# Conditional compilation for disasm +(def disasm-alias (if-let [x (_env 'disasm)] (x :value))) + (defn .disasm "Gets the assembly for the current function." [&opt n] (def frame (.frame n)) (def func (frame :function)) - (disasm func)) + (disasm-alias func)) (defn .bytecode "Get the bytecode for the current function." @@ -2392,10 +2395,10 @@ [&opt n] (def frame (.frame n)) (def func (frame :function)) - (def dasm (disasm func)) - (def bytecode (dasm 'bytecode)) + (def dasm (disasm-alias func)) + (def bytecode (disasm-alias 'bytecode)) (def pc (frame :pc)) - (def sourcemap (dasm 'sourcemap)) + (def sourcemap (disasm-alias 'sourcemap)) (var last-loc [-2 -2]) (print "\n signal: " (.signal)) (print " function: " (dasm 'name) " [" (in dasm 'source "") "]") @@ -2417,6 +2420,11 @@ (print)) (print)) +(unless (get _env 'disasm) + (put _env .disasm nil) + (put _env .bytecode nil) + (put _env .ppasm nil)) + (defn .source "Show the source code for the function being debugged." [&opt n]