From 99af8891f6672493939bf3b43084082884e28d04 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Fri, 17 Jul 2026 04:37:37 -0400 Subject: fix scope thing --- codegen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'codegen.c') diff --git a/codegen.c b/codegen.c index ae94d9f..bdc3cbf 100644 --- a/codegen.c +++ b/codegen.c @@ -100,6 +100,8 @@ static void emit_storage_loc( case STO_IMM: fprintf(outfile, "%llu", loc->value); break; + case STO_UNRESOLVED: + CGEN_PANIC("can't emit unresolved storage location"); } } @@ -120,6 +122,8 @@ static bool locs_equal( return strcmp(a->label, b->label) == 0; case STO_FN: return a->decl == b->decl; + case STO_UNRESOLVED: + return false; } CGEN_PANIC("unhandled storage type case"); } @@ -176,6 +180,8 @@ static void emit_mov( case STO_IMM: CGEN_PANIC( "can't move value into immediate value %lld", dst->loc.value); + case STO_UNRESOLVED: + CGEN_PANIC("can't move value into unresolved storage"); } fprintf(outfile, "\n"); } @@ -580,6 +586,7 @@ static void emit_fn_decl(FILE* outfile, const struct fn_decl_node* node) { while (arg_decl != NULL) { struct lval_def arg_dst = make_stack_lval(outfile, &arg_decl->decl->type); + /* TODO: type checker should define vars, we just set their loc */ scope_define_var( scope, (struct var_def) { -- cgit v1.2.3