Detect type aliasing cycles
This commit is contained in:
@ -142,8 +142,28 @@ namespace elna::boot
|
||||
this->current_type = type(result_type);
|
||||
}
|
||||
|
||||
void declaration_visitor::visit(procedure_type_expression *)
|
||||
void declaration_visitor::visit(procedure_type_expression *type_expression)
|
||||
{
|
||||
std::shared_ptr<procedure_type> result_type;
|
||||
|
||||
if (type_expression->return_type.no_return)
|
||||
{
|
||||
result_type = std::make_shared<procedure_type>(procedure_type::return_t(std::monostate{}));
|
||||
}
|
||||
else if (type_expression->return_type.proper_type != nullptr)
|
||||
{
|
||||
type_expression->return_type.proper_type->accept(this);
|
||||
result_type = std::make_shared<procedure_type>(procedure_type::return_t(this->current_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
result_type = std::make_shared<procedure_type>(procedure_type::return_t());
|
||||
}
|
||||
for (auto& parameter : type_expression->parameters)
|
||||
{
|
||||
parameter->accept(this);
|
||||
result_type->parameters.push_back(this->current_type);
|
||||
}
|
||||
}
|
||||
|
||||
void declaration_visitor::visit(variable_declaration *declaration)
|
||||
@ -161,9 +181,9 @@ namespace elna::boot
|
||||
{
|
||||
heading_parameter->accept(this);
|
||||
}
|
||||
if (definition->heading().return_type.type != nullptr)
|
||||
if (definition->heading().return_type.proper_type != nullptr)
|
||||
{
|
||||
definition->heading().return_type.type->accept(this);
|
||||
definition->heading().return_type.proper_type->accept(this);
|
||||
}
|
||||
if (definition->body != nullptr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user