Merge pull request #5558 from odin-lang/bill/init-fini-changes

`@(init)` & `@(finit)` Changes.
This commit is contained in:
gingerBill
2025-08-10 12:47:15 +01:00
committed by GitHub
67 changed files with 226 additions and 136 deletions

View File

@@ -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()'");
}
}
}