summaryrefslogtreecommitdiff
path: root/pit/src/native.c
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-09-01 06:26:13 -0400
committerLLLL Colonq <llll@colonq>2026-09-01 06:26:13 -0400
commitff7407c146b8129c2f1cc7ebe3b5771ad2f5dfdd (patch)
treebc70d9773ebc0deb25773d3b5c86ec7ea96eef6d /pit/src/native.c
parent6ebac820c84b218a45368eeaf1c853ff9c9d638f (diff)
pit: Fix evaluatorHEADmaster
Diffstat (limited to 'pit/src/native.c')
-rw-r--r--pit/src/native.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pit/src/native.c b/pit/src/native.c
index b5b13e1..d3f2e95 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,7 +109,9 @@ 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;
+ 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;