diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-10 15:03:30 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-10 15:03:30 +0100 |
| commit | 983f3ec423a6a424c0e64ed2a5de41edffc459ec (patch) | |
| tree | 4ac641bb1b7f9d36564b27020c4f392e6c1e5f27 /src/check_decl.cpp | |
| parent | 1524b40bc949765faa185644356a7c7caffac98c (diff) | |
Add `#+feature global-context`
This allows to use of `context` in the global scope on a per file basis.
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index ee7906e5e..b2522f24a 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -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; |