Unify the build_type function

This commit is contained in:
Eugen Wissner 2025-03-06 22:59:41 +01:00
parent dbeaca7cbf
commit 98ec95d69c
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0

View File

@ -79,7 +79,16 @@ namespace gcc
{ {
if (auto alias_node = type_expression->is_primitive()) if (auto alias_node = type_expression->is_primitive())
{ {
return this->unresolved.at(alias_node->name); auto unresolved_alias = this->unresolved.find(alias_node->name);
if (unresolved_alias != this->unresolved.end())
{
return unresolved_alias->second;
}
else
{
return new boot::primitive_type(alias_node->name);
}
} }
else if (auto alias_node = type_expression->is_record()) else if (auto alias_node = type_expression->is_record())
{ {
@ -112,27 +121,7 @@ namespace gcc
{ {
auto unresolved_declaration = this->unresolved.at(type->identifier); auto unresolved_declaration = this->unresolved.at(type->identifier);
if (auto alias_node = type->body().is_primitive()) unresolved_declaration->reference = build_type(&type->body());
{
auto unresolved_alias = this->unresolved.find(alias_node->name);
if (unresolved_alias != this->unresolved.end())
{
unresolved_declaration->reference = unresolved_alias->second;
}
else
{
unresolved_declaration->reference = new boot::primitive_type(alias_node->name);
}
}
else if (auto alias_node = type->body().is_record())
{
unresolved_declaration->reference = build_record(alias_node.get());
}
else if (auto alias_node = type->body().is_union())
{
unresolved_declaration->reference = build_union(alias_node.get());
}
} }
for (auto unresolved : this->unresolved) for (auto unresolved : this->unresolved)
{ {