diff options
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; } |
