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;