From f547dae96d770cc7bc27d3790d0d87bb8e37963d Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 7 Oct 2026 10:15:16 +0200 Subject: Make procedure pointers compatible with normal pointers --- boot/name_analysis.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'boot/name_analysis.cc') diff --git a/boot/name_analysis.cc b/boot/name_analysis.cc index 1a87927..12a14c3 100644 --- a/boot/name_analysis.cc +++ b/boot/name_analysis.cc @@ -152,6 +152,8 @@ namespace elna::boot return "const must be written before the array size, not after"; case duplicate: return "Duplicate 'const' qualifier is not allowed"; + case constant_procedure: + return "Procedure types are always constant, 'const' is not allowed"; case module_entry: return "Program entry point should have no or one argument"; default: @@ -583,6 +585,11 @@ namespace elna::boot add_error(expression->position(), declaration_format_error::kind::duplicate); } + else if (qualified_base.get() != nullptr) + { + add_error(expression->position(), + declaration_format_error::kind::constant_procedure); + } this->current_type = qualified_base.empty() ? type() : type(std::make_shared(qualified_base)); @@ -807,7 +814,9 @@ namespace elna::boot void resolving_visitor::visit(procedure_call *call) { call->callable().accept(this); - if (const auto procedure = call->callable().type_decoration.get()) + const type callable_type = resolve_underlying_type(call->callable().type_decoration); + + if (const auto procedure = callable_type.get()) { call->type_decoration = procedure->return_type; } -- cgit v1.2.3