1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 19:19:53 +00:00

Update printing when entering debugger.

This commit is contained in:
Calvin Rose 2021-03-19 15:38:46 -05:00
parent b3e80308d4
commit 90e5828d5d
2 changed files with 8 additions and 13 deletions

View File

@ -3127,9 +3127,6 @@
(put nextenv :debug-level level) (put nextenv :debug-level level)
(put nextenv :signal x) (put nextenv :signal x)
(merge-into nextenv debugger-env) (merge-into nextenv debugger-env)
(eprint (fiber/status f) ": " x)
(debug/stacktrace f x)
(eflush)
(defn debugger-chunks [buf p] (defn debugger-chunks [buf p]
(def status (:state p :delimiters)) (def status (:state p :delimiters))
(def c ((:where p) 0)) (def c ((:where p) 0))
@ -3149,9 +3146,12 @@
(put e '_ @{:value x}) (put e '_ @{:value x})
(printf (get e :pretty-format "%q") x) (printf (get e :pretty-format "%q") x)
(flush)) (flush))
(if (e :debug) (do
(enter-debugger f x) (def ec (dyn :err-color))
(do (eprint fs ": " x) (debug/stacktrace f x) (eflush)))))) (eprint (if ec "\e[31m" "") fs ": " x)
(debug/stacktrace f)
(eflush)
(if (e :debug) (enter-debugger f x))))))
(run-context {:env env (run-context {:env env
:chunks chunks :chunks chunks

View File

@ -275,14 +275,9 @@ static Janet call_nonfn(JanetFiber *fiber, Janet callee) {
return janet_method_invoke(callee, argc, fiber->data + fiber->stacktop); return janet_method_invoke(callee, argc, fiber->data + fiber->stacktop);
} }
/* Method lookup could potentially handle tables specially... */
static Janet method_to_fun(Janet method, Janet obj) { static Janet method_to_fun(Janet method, Janet obj) {
if (janet_checktype(obj, JANET_TABLE)) {
JanetTable *proto = janet_unwrap_table(obj)->proto;
if (NULL == proto) return janet_wrap_nil();
return janet_table_get(proto, method);
} else {
return janet_get(obj, method); return janet_get(obj, method);
}
} }
/* Get a callable from a keyword method name and ensure that it is valid. */ /* Get a callable from a keyword method name and ensure that it is valid. */