Add #+feature global-context

This allows to use of `context` in the global scope on a per file basis.
This commit is contained in:
gingerBill
2025-08-10 15:03:30 +01:00
parent 1524b40bc9
commit 983f3ec423
2 changed files with 13 additions and 1 deletions

View File

@@ -1855,7 +1855,12 @@ gb_internal void check_entity_decl(CheckerContext *ctx, Entity *e, DeclInfo *d,
auto prev_flags = c.scope->flags;
defer (c.scope->flags = prev_flags);
c.scope->flags &= ~ScopeFlag_ContextDefined;
if (check_feature_flags(ctx, d->decl_node) & OptInFeatureFlag_GlobalContext) {
c.scope->flags |= ScopeFlag_ContextDefined;
} else {
c.scope->flags &= ~ScopeFlag_ContextDefined;
}
e->parent_proc_decl = c.curr_proc_decl;