fix namespace assignment to special name list
This commit is contained in:
parent
07ae36e672
commit
c4cc861054
6
src/ns.c
6
src/ns.c
@ -9,14 +9,15 @@ void m_nsDesc(Body* body, bool imm, u8 ty, B nameList, B varIDs, B exported) { /
|
||||
if (ia!=a(exported)->ia) thrM("Bad namespace description information");
|
||||
i32 off = (ty==0?0:ty==1?2:3) + (imm?0:3);
|
||||
i32 vam = ia+off;
|
||||
i32 actualVam = body->varAm;
|
||||
// if (vam != body->varAm) thrM("Bad namespace description information"); // arg remapping makes body->varAm unrelated to named variable count
|
||||
|
||||
NSDesc* r = mm_alloc(fsizeof(NSDesc, expIDs, i32, vam), t_nsDesc);
|
||||
NSDesc* r = mm_alloc(fsizeof(NSDesc, expIDs, i32, actualVam), t_nsDesc);
|
||||
r->nameList = nameList;
|
||||
r->varAm = vam;
|
||||
SGetU(varIDs)
|
||||
SGetU(exported)
|
||||
for (i32 i = 0; i < off; i++) {
|
||||
for (i32 i = 0; i < actualVam; i++) {
|
||||
body->varIDs[i] = -1;
|
||||
r ->expIDs[i] = -1;
|
||||
}
|
||||
@ -42,6 +43,7 @@ B ns_getU(B ns, B cNL, i32 nameID) { VTY(ns, t_ns);
|
||||
NS* n = c(NS, ns);
|
||||
NSDesc* d = n->desc;
|
||||
i32 dVarAm = d->varAm;
|
||||
if (nameID<0) thrM("Cannot read key with special name");
|
||||
assert((u64)nameID < a(cNL)->ia && nameID>=0);
|
||||
B dNL = d->nameList;
|
||||
if (cNL.u != dNL.u) {
|
||||
|
||||
3
src/vm.c
3
src/vm.c
@ -276,10 +276,11 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
|
||||
c = nextBC(c);
|
||||
}
|
||||
if (remapArgs) {
|
||||
if (sc && depth==0) thrM("Predicates cannot be used directly in a REPL");
|
||||
c = bc+idx;
|
||||
bool argUsed[6] = {0,0,0,0,0,0};
|
||||
while (*c!=RETN & *c!=RETD) {
|
||||
if (*c==VARO | *c==VARM | *c==VARU) if (c[1]==0 && c[2]<argAm) argUsed[c[2]]++;
|
||||
if (*c==VARO | *c==VARM | *c==VARU) if (c[1]==0 && c[2]<argAm) argUsed[c[2]]++;
|
||||
c = nextBC(c);
|
||||
}
|
||||
for (i32 i = 0; i < 6; i++) if (argUsed[i]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user