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);
}
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);
}

View File

@ -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");

View File

@ -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