diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-07 10:15:16 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-07 10:15:16 +0200 |
| commit | f547dae96d770cc7bc27d3790d0d87bb8e37963d (patch) | |
| tree | 052abb2d81cabc5a3c5bde7d623ef2af9dcd45e9 /boot/name_analysis.cc | |
| parent | f9dfefc52fc792099b622ae47dafa32d2512e51e (diff) | |
| download | elna-f547dae96d770cc7bc27d3790d0d87bb8e37963d.tar.gz | |
Make procedure pointers compatible with normal pointers
Diffstat (limited to 'boot/name_analysis.cc')
| -rw-r--r-- | boot/name_analysis.cc | 11 |
1 files changed, 10 insertions, 1 deletions
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<declaration_format_error>(expression->position(), declaration_format_error::kind::duplicate); } + else if (qualified_base.get<procedure_type>() != nullptr) + { + add_error<declaration_format_error>(expression->position(), + declaration_format_error::kind::constant_procedure); + } this->current_type = qualified_base.empty() ? type() : type(std::make_shared<constant_type>(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<procedure_type>()) + const type callable_type = resolve_underlying_type(call->callable().type_decoration); + + if (const auto procedure = callable_type.get<procedure_type>()) { call->type_decoration = procedure->return_type; } |
