aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-09-09 10:36:22 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-09-09 10:36:22 +0100
commit9abc3f67b52860f3fe85bfdbcd3bc014a4651ad5 (patch)
tree655a66833706110d4c3861fff6431fb66a28732d
parente2c1f86946481dc7680148643060216781582837 (diff)
Fix constant procedure parameters when passing literals
-rw-r--r--src/check_expr.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 542a2afa1..e005b0bd0 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -6473,7 +6473,14 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A
}
if (e && e->kind == Entity_Constant && is_type_proc(e->type)) {
- if (o->mode != Addressing_Constant) {
+ bool ok = false;
+ if (o->mode == Addressing_Constant) {
+ ok = true;
+ } else if (o->value.kind == ExactValue_Procedure) {
+ ok = true;
+ }
+
+ if (!ok) {
if (show_error) {
error(o->expr, "Expected a constant procedure value for the argument '%.*s'", LIT(e->token.string));
}
@@ -11423,6 +11430,7 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
o->mode = Addressing_Value;
o->type = type;
+ o->value = exact_value_procedure(node);
case_end;
case_ast_node(te, TernaryIfExpr, node);