From 452a117818866f08bfbc14422baa6fec8dbcacd8 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 14 Sep 2024 18:21:23 +0300 Subject: [PATCH] print precompiled source name & line number in stacktraces --- src/main.c | 3 ++- src/vm.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index b994a68f..98c386dd 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,8 @@ #error "Cannot use USE_REPLXX_IO without USE_REPLXX" #endif -STATIC_GLOBAL B replPath, replName; +STATIC_GLOBAL B replPath; +GLOBAL B replName; // used in vm.c STATIC_GLOBAL Scope* gsc; STATIC_GLOBAL bool repl_initialized = false; diff --git a/src/vm.c b/src/vm.c index 3e87feee..28fa48e6 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1334,6 +1334,7 @@ void popCatch() { } #endif +extern GLOBAL B replName; // from main.c NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce) { // consumes prepend SGetU(src) usz srcL = IA(src); @@ -1346,8 +1347,8 @@ NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce) { // consumes p i64 ln = 1; for (usz i = 0; i < srcS; i++) if(o2cG(GetU(src, i))=='\n') ln++; B s = prepend; - if (isArr(path) && (IA(path)==0 || IGetU(path,0).u!=m_c32('(').u)) AFMT("%R:%l:\n ", path, ln); - else AFMT("at "); + if (!isArr(path) || path.u==replName.u) AFMT("at "); + else AFMT("%R:%l:\n ", path, ln); i64 padEnd = (i64)IA(s); i64 padStart = padEnd; SGetU(s)