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);
|
if (prevImports==NULL) prevImports = m_b2i(16);
|
||||||
|
|
||||||
bool had; i32 prev = mk_b2i(&prevImports, path, &had);
|
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;
|
prevImports->a[prev].val = -2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -652,13 +652,21 @@ B import_c1(B d, B x) {
|
|||||||
return IGet(importValList, prevIdx);
|
return IGet(importValList, prevIdx);
|
||||||
}
|
}
|
||||||
if (prevIdx==-2) thrF("•Import: cyclic import of \"%R\"", path);
|
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());
|
B r = bqn_execFile(inc(path), emptySVec());
|
||||||
|
|
||||||
i32 prevLen = a(importKeyList)->ia;
|
harr_ptr(importValList)[prevLen] = inc(r);
|
||||||
// print_fmt("caching: %R @ %i\n", path, prevLen);
|
|
||||||
setPrevImport(path, prevLen);
|
setPrevImport(path, prevLen);
|
||||||
importKeyList = vec_addN(importKeyList, path);
|
popCatch();
|
||||||
importValList = vec_addN(importValList, inc(r));
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
static void sys_gcFn() {
|
static void sys_gcFn() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user