diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-08 12:23:22 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-08 12:23:22 +0100 |
| commit | 06e48099ca808dc9d5b3fbcaebebd4123f097a86 (patch) | |
| tree | 72ca5d17e49e7a7e98fe016304d6f262f0d5d3b3 | |
| parent | b86932c03c51efbb6c6146f8c91dd03bf82ab226 (diff) | |
Improve error message
| -rw-r--r-- | src/check_expr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index faa338f36..e3881986b 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -8166,8 +8166,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()'"); + } } } |