From 3d74c2f6c0797345c2bdfae77c619057227e8181 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 26 Feb 2020 22:53:40 +0000 Subject: Add `proc(#const x: Type)` to enforce a constant parameter (but not polymorphic) to a procedure --- src/check_type.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 97b9985c8..6194951c9 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1722,8 +1722,11 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is if (p->flags&FieldFlag_auto_cast) { param->flags |= EntityFlag_AutoCast; } - param->state = EntityState_Resolved; // NOTE(bill): This should have be resolved whilst determining it + if (p->flags&FieldFlag_const) { + param->flags |= EntityFlag_ConstInput; + } + param->state = EntityState_Resolved; // NOTE(bill): This should have be resolved whilst determining it add_entity(ctx->checker, scope, name, param); if (is_using) { add_entity_use(ctx, name, param); -- cgit v1.2.3