From e0a242e9a1f792752213e41fcc3603565d3d8986 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 14 May 2020 13:44:28 +0100 Subject: Enforce explicit context definition for procedure calls --- src/check_expr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4d3268f44..e6812b81d 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7411,6 +7411,12 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call, Type *t Type *pt = base_type(proc_type); + if (pt->kind == Type_Proc && pt->Proc.calling_convention == ProcCC_Odin) { + if ((c->scope->flags & ScopeFlag_ContextDefined) == 0) { + error(call, "'context' has not been defined within this scope, but is required for this procedure call"); + } + } + #if 0 if (pt->kind == Type_Proc && pt->Proc.calling_convention == ProcCC_Odin) { init_core_context(c->checker); -- cgit v1.2.3