properly keep track of current scope for debugging

Fixes #4519
This commit is contained in:
Laytan Laats
2024-11-27 20:53:56 +01:00
committed by flysand7
parent 2bd6fc9ebd
commit d51692a3b4

View File

@@ -201,6 +201,8 @@ gb_internal void lb_open_scope(lbProcedure *p, Scope *s) {
}
}
GB_ASSERT(s != nullptr);
p->curr_scope = s;
p->scope_index += 1;
array_add(&p->scope_stack, s);
@@ -221,6 +223,10 @@ gb_internal void lb_close_scope(lbProcedure *p, lbDeferExitKind kind, lbBlock *b
}
if (p->curr_scope) {
p->curr_scope = p->curr_scope->parent;
}
p->scope_index -= 1;
array_pop(&p->scope_stack);
}