diff options
Diffstat (limited to 'pit/src/native.c')
| -rw-r--r-- | pit/src/native.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pit/src/native.c b/pit/src/native.c index b5b13e1..dbb461d 100644 --- a/pit/src/native.c +++ b/pit/src/native.c @@ -36,6 +36,7 @@ bool pit_runtime_print_error(pit_runtime *rt) { for (i64 i = 0; i < rt->callstack->next; ++i) { pit_callstack_entry *a = pit_vec_get(pit_callstack_entry)(rt->callstack, i); if (a == NULL) continue; + if (a->tag == PIT_NIL) continue; fprintf(stderr, "on line %ld, column %ld (call to ", a->ann.line, a->ann.column); pit_dump_to_file(rt, stderr, a->tag, false); fprintf(stderr, "):\n"); @@ -99,6 +100,7 @@ pit_value pit_load_file(pit_runtime *rt, char *path) { pit_parser parse; bool eof = false; pit_value p = PIT_NIL; + pit_value compiled = PIT_NIL; pit_value ret = PIT_NIL; if (pit_lex_file(&lex, path) < 0) { pit_error(rt, "failed to lex file: %s", path); @@ -107,10 +109,12 @@ pit_value pit_load_file(pit_runtime *rt, char *path) { pit_parser_from_lexer(&parse, &lex); while (p = pit_parse(rt, &parse, &eof), !eof) { check_invariants(rt); if (pit_runtime_print_error(rt)) return PIT_NIL; - ret = pit_vm_eval(rt, pit_compile(rt, pit_macroexpand(rt, p))); + compiled = pit_compile(rt, p); check_invariants(rt); if (pit_runtime_print_error(rt)) return PIT_NIL; - pit_gc(rt); + ret = pit_vm_eval(rt, compiled); check_invariants(rt); if (pit_runtime_print_error(rt)) return PIT_NIL; + // pit_gc(rt); + // check_invariants(rt); if (pit_runtime_print_error(rt)) return PIT_NIL; } check_invariants(rt); if (pit_runtime_print_error(rt)) return PIT_NIL; return ret; |
