summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2025-10-21 06:17:03 -0400
committerWormHeamer2025-10-21 06:17:03 -0400
commitb44e40db00906982485d98bebc2e3bed6c9783b9 (patch)
treee00ee601e6ec5de970cd4cca3268e844f474b585
parent3ca04326ddb36b8551acf417ef195d1572bb3d47 (diff)
scratch arena reset has to happen in parse_proc, not parse_block
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
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);