fix •Import when execution errors
This commit is contained in:
parent
2dbbb3415e
commit
d3555b4af6
@ -306,7 +306,7 @@ i32 getPrevImport(B path) { // -1 for unset, -2 for unfinished
|
||||
if (prevImports==NULL) prevImports = m_b2i(16);
|
||||
|
||||
bool had; i32 prev = mk_b2i(&prevImports, path, &had);
|
||||
if (had) return prevImports->a[prev].val;
|
||||
if (had && prevImports->a[prev].val!=-1) return prevImports->a[prev].val;
|
||||
prevImports->a[prev].val = -2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -652,13 +652,21 @@ B import_c1(B d, B x) {
|
||||
return IGet(importValList, prevIdx);
|
||||
}
|
||||
if (prevIdx==-2) thrF("•Import: cyclic import of \"%R\"", path);
|
||||
if (CATCH) {
|
||||
setPrevImport(path, -1);
|
||||
rethrow();
|
||||
}
|
||||
|
||||
i32 prevLen = a(importValList)->ia;
|
||||
importKeyList = vec_addN(importKeyList, path);
|
||||
importValList = vec_addN(importValList, bi_N);
|
||||
|
||||
B r = bqn_execFile(inc(path), emptySVec());
|
||||
|
||||
i32 prevLen = a(importKeyList)->ia;
|
||||
// print_fmt("caching: %R @ %i\n", path, prevLen);
|
||||
harr_ptr(importValList)[prevLen] = inc(r);
|
||||
setPrevImport(path, prevLen);
|
||||
importKeyList = vec_addN(importKeyList, path);
|
||||
importValList = vec_addN(importValList, inc(r));
|
||||
popCatch();
|
||||
|
||||
return r;
|
||||
}
|
||||
static void sys_gcFn() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user