From 6fb3f2d6a6ed05d2e8870cdd7d11a063ef04644d Mon Sep 17 00:00:00 2001 From: zongor Date: Sat, 4 Jul 2026 19:15:26 -0700 Subject: [PATCH] fix scope bug --- compiler.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler.c b/compiler.c index b2079f0..ce2687f 100644 --- a/compiler.c +++ b/compiler.c @@ -54,10 +54,9 @@ scope_pop(void) void scope_push(void) { - Scope *scope = List_get(parser->scopes, parser->scope_idx); - parser->current_scope = scope; - parser->depth++; parser->scope_idx++; + parser->depth++; + parser->current_scope = (Scope *)List_get(parser->scopes, parser->scope_idx); } Symbol * @@ -1144,6 +1143,7 @@ compile(Arena *a, List *c, List *m, Emitter *e, char *source) parser->pass++; parser->depth = 0; parser->scope_idx = 0; + parser->current_scope = List_get(parser->scopes, 0); emit_program(source); return true;