aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-08-08 12:21:50 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-08-08 12:21:50 +0100
commitb86932c03c51efbb6c6146f8c91dd03bf82ab226 (patch)
tree038149bdafcd85defca83aef6c187b93cef3ec78
parent8b860da2eb5f65ac23702d7f139da46646ba2ec1 (diff)
Disallow `proc "odin"` procedures to be called in the global scope in variable declarations
-rw-r--r--src/check_decl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index af46ee40e..ee7906e5e 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -1851,6 +1851,12 @@ gb_internal void check_entity_decl(CheckerContext *ctx, Entity *e, DeclInfo *d,
c.scope = d->scope;
c.decl = d;
c.type_level = 0;
+ c.curr_proc_calling_convention = ProcCC_Contextless;
+
+ auto prev_flags = c.scope->flags;
+ defer (c.scope->flags = prev_flags);
+ c.scope->flags &= ~ScopeFlag_ContextDefined;
+
e->parent_proc_decl = c.curr_proc_decl;
e->state = EntityState_InProgress;