diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index f998b722..e7f0b792 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -216,6 +216,7 @@ B asrt_c2(B t, B w, B x) { thr(w); } B casrt_c2(B t, B w, B x) { + B fullpath = load_fullpath(COMPS_CREF(path), COMPS_CREF(name)); if (LIKELY(isF64(x) && o2fG(x)==1)) { dec(w); return x; } unwindCompiler(); dec(x); @@ -225,21 +226,21 @@ B casrt_c2(B t, B w, B x) { B s = IGet(w,1); AFMT("\n"); usz pos = o2s(w0); - s = vm_fmtPoint(COMPS_CREF(src), s, COMPS_CREF(path), pos, pos+1); + s = vm_fmtPoint(COMPS_CREF(src), s, fullpath, pos, pos+1); dec(w); thr(s); } if (isArr(w0) && RNK(w0)==1 && IA(w0)>=1) { B s = IGet(w,1); AFMT("\n"); usz pos = o2s(IGetU(w0,0)); - s = vm_fmtPoint(COMPS_CREF(src), s, COMPS_CREF(path), pos, pos+1); + s = vm_fmtPoint(COMPS_CREF(src), s, fullpath, pos, pos+1); dec(w); thr(s); } if (isArr(w0) && RNK(w0)==2 && IA(w0)>=2) { B s = IGet(w,1); AFMT("\n"); SGetU(w0) - s = vm_fmtPoint(COMPS_CREF(src), s, COMPS_CREF(path), o2s(GetU(w0,0)), o2s(GetU(w0,1))+1); + s = vm_fmtPoint(COMPS_CREF(src), s, fullpath, o2s(GetU(w0,0)), o2s(GetU(w0,1))+1); dec(w); thr(s); } diff --git a/src/load.c b/src/load.c index e0006370..41ed3e0b 100644 --- a/src/load.c +++ b/src/load.c @@ -123,12 +123,16 @@ static NOINLINE B evalFunBlockConsume(Block* block) { return r; } +NOINLINE B load_fullpath(B path, B name) { + return q_N(name)? inc(path) : q_N(path)? inc(name) : IA(path)==1 && IGetU(path,0).u==m_c32('.').u? inc(name) : path_rel(path, inc(name), "(load_fullpath)"); +} + GLOBAL HArr* comps_curr; GLOBAL B rt_undo, rt_select, rt_slash, rt_insert, rt_depth, rt_group, rt_under, rt_find; Block* load_buildBlock(B x, B src, B path, B name, Scope* sc, i32 nsResult) { // consumes x,src - B fullpath = q_N(name)? inc(path) : q_N(path)? inc(name) : IA(path)==1 && IGetU(path,0).u==m_c32('.').u? inc(name) : path_rel(path, inc(name), "(load_buildBlock)"); + B fullpath = load_fullpath(path, name); SGet(x) usz xia = IA(x); if (xia!=6 & xia!=4) thrM("load_buildBlock: bad item count"); diff --git a/src/load.h b/src/load.h index 5ad227a4..d2805a7f 100644 --- a/src/load.h +++ b/src/load.h @@ -25,6 +25,7 @@ void comps_getSysvals(B* res); typedef struct Block Block; typedef struct Scope Scope; +NOINLINE B load_fullpath(B path, B name); // doesn't consume B bqn_explain(B str); // consumes str B bqn_execFile(B path, B args); // consumes both B bqn_execFileRe(B path, B args, B re); // consumes path,args