aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-08-10 12:47:15 +0100
committerGitHub <noreply@github.com>2025-08-10 12:47:15 +0100
commita0ff05e63307f533b384820717bb582e1ff47c39 (patch)
treed9adfd28090dc72044003fed211383a63bdb3587 /src/check_expr.cpp
parentdbc338248e8693994f232d02f1aff9536f204add (diff)
parent14ca1c8c89dd219dd52d061649d4db7778df2e64 (diff)
Merge pull request #5558 from odin-lang/bill/init-fini-changes
`@(init)` & `@(finit)` Changes.
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 6a50b553e..db82a60ce 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -8169,8 +8169,12 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
if (pt->kind == Type_Proc && pt->Proc.calling_convention == ProcCC_Odin) {
if ((c->scope->flags & ScopeFlag_ContextDefined) == 0) {
ERROR_BLOCK();
- error(call, "'context' has not been defined within this scope, but is required for this procedure call");
- error_line("\tSuggestion: 'context = runtime.default_context()'");
+ if (c->scope->flags & ScopeFlag_File) {
+ error(call, "Procedures requiring a 'context' cannot be called at the global scope");
+ } else {
+ error(call, "'context' has not been defined within this scope, but is required for this procedure call");
+ error_line("\tSuggestion: 'context = runtime.default_context()'");
+ }
}
}