1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +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 :signal x)
(merge-into nextenv debugger-env)
(eprint (fiber/status f) ": " x)
(debug/stacktrace f x)
(eflush)
(defn debugger-chunks [buf p]
(def status (:state p :delimiters))
(def c ((:where p) 0))
@ -3149,9 +3146,12 @@
(put e '_ @{:value x})
(printf (get e :pretty-format "%q") x)
(flush))
(if (e :debug)
(enter-debugger f x)
(do (eprint fs ": " x) (debug/stacktrace f x) (eflush))))))
(do
(def ec (dyn :err-color))
(eprint (if ec "\e[31m" "") fs ": " x)
(debug/stacktrace f)
(eflush)
(if (e :debug) (enter-debugger f x))))))
(run-context {:env env
: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);
}
/* Method lookup could potentially handle tables specially... */
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. */