include file name in failed complication error messages

This commit is contained in:
dzaima 2024-02-01 22:52:55 +02:00
parent 88f8daedbf
commit 1e8c390e6a
3 changed files with 10 additions and 4 deletions

View File

@ -216,6 +216,7 @@ B asrt_c2(B t, B w, B x) {
thr(w); thr(w);
} }
B casrt_c2(B t, B w, B x) { 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; } if (LIKELY(isF64(x) && o2fG(x)==1)) { dec(w); return x; }
unwindCompiler(); unwindCompiler();
dec(x); dec(x);
@ -225,21 +226,21 @@ B casrt_c2(B t, B w, B x) {
B s = IGet(w,1); B s = IGet(w,1);
AFMT("\n"); AFMT("\n");
usz pos = o2s(w0); 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); dec(w);
thr(s); thr(s);
} }
if (isArr(w0) && RNK(w0)==1 && IA(w0)>=1) { if (isArr(w0) && RNK(w0)==1 && IA(w0)>=1) {
B s = IGet(w,1); AFMT("\n"); B s = IGet(w,1); AFMT("\n");
usz pos = o2s(IGetU(w0,0)); 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); dec(w);
thr(s); thr(s);
} }
if (isArr(w0) && RNK(w0)==2 && IA(w0)>=2) { if (isArr(w0) && RNK(w0)==2 && IA(w0)>=2) {
B s = IGet(w,1); AFMT("\n"); B s = IGet(w,1); AFMT("\n");
SGetU(w0) 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); dec(w);
thr(s); thr(s);
} }

View File

@ -123,12 +123,16 @@ static NOINLINE B evalFunBlockConsume(Block* block) {
return r; 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 HArr* comps_curr;
GLOBAL B rt_undo, rt_select, rt_slash, rt_insert, rt_depth, GLOBAL B rt_undo, rt_select, rt_slash, rt_insert, rt_depth,
rt_group, rt_under, rt_find; rt_group, rt_under, rt_find;
Block* load_buildBlock(B x, B src, B path, B name, Scope* sc, i32 nsResult) { // consumes x,src 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) SGet(x)
usz xia = IA(x); usz xia = IA(x);
if (xia!=6 & xia!=4) thrM("load_buildBlock: bad item count"); if (xia!=6 & xia!=4) thrM("load_buildBlock: bad item count");

View File

@ -25,6 +25,7 @@ void comps_getSysvals(B* res);
typedef struct Block Block; typedef struct Block Block;
typedef struct Scope Scope; typedef struct Scope Scope;
NOINLINE B load_fullpath(B path, B name); // doesn't consume
B bqn_explain(B str); // consumes str B bqn_explain(B str); // consumes str
B bqn_execFile(B path, B args); // consumes both B bqn_execFile(B path, B args); // consumes both
B bqn_execFileRe(B path, B args, B re); // consumes path,args B bqn_execFileRe(B path, B args, B re); // consumes path,args