From b44e40db00906982485d98bebc2e3bed6c9783b9 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Tue, 21 Oct 2025 06:17:03 -0400 Subject: scratch arena reset has to happen in parse_proc, not parse_block --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 4f48ade..3315f2a 100644 --- a/main.c +++ b/main.c @@ -130,7 +130,6 @@ void parse_stmt(Lexer *l, Proc *p); void parse_block(Lexer *l, Proc *p) { Graph *g = &p->graph; lex_next(l); - arena_reset(&p->scratch); scope_push(&p->scope); while (l->tok != TOK_RBRACE) { lex_expected_not(l, TM_EOF); @@ -330,7 +329,7 @@ void parse_if(Lexer *l, Proc *p) { assert(region->in.data[0]); assert(region->in.data[1]); - scope_changelist_merge(&p->scope, &chg_if, &chg_else, region, g, &p->scratch); + scope_changelist_merge(&p->scope, l, &chg_if, &chg_else, region, g, &p->scratch); scope_changelist_discard(&chg_if, g); scope_changelist_discard(&chg_else, g); node_del_out(region, g->keepalive); @@ -499,6 +498,7 @@ Proc *parse_proc(Lexer *l, Unit *u) { while (l->tok != TOK_RBRACE) { lex_expected_not(l, TM_EOF); parse_stmt(l, proc); + arena_reset(&proc->scratch); } scope_pop(&proc->scope, &proc->graph); lex_expected(l, TM_RBRACE); -- cgit v1.2.3