this should be handled in the compile end nat

This commit is contained in:
tocariimaa 2025-02-05 19:18:46 -03:00
parent 8a0a2cf68f
commit bc9bc44e5d

20
pila.c
View file

@ -393,8 +393,14 @@ compile_end_nat(Pila *st)
return;
}
Assert(st->cur_compw != nil);
if (!Str_empty(st->cur_compw->name))
add_word(st, st->cur_compw);
else /* for an anonymous word */
push_val(st, BOX_INTN((u64)st->cur_compw));
st->compiling = false;
add_word(st, st->cur_compw);
st->cur_compw = nil;
st->cur_compw_cap = 0;
}
Str
@ -499,14 +505,10 @@ branch_nat(Pila *st)
void
add_word(Pila *st, Word *w)
{
if (!Str_empty(w->name)) {
DictionaryEntry *de = malloc(sizeof(*de));
de->word = w;
de->next = st->dict != nil ? st->dict : nil;
st->dict = de;
} else {
push_val(st, BOX_INTN((u64)w));
}
DictionaryEntry *de = malloc(sizeof(*de));
de->word = w;
de->next = st->dict != nil ? st->dict : nil;
st->dict = de;
}
Word *