Implement .max and .min type properties

This commit is contained in:
2025-02-16 07:53:31 +01:00
parent b358f8ba27
commit 031587e6f9
5 changed files with 259 additions and 262 deletions

View File

@ -68,7 +68,7 @@ namespace gcc
}
else if (is_pointer_type(type))
{
return std::string("pointer to " + print_type(TREE_TYPE(type)));
return std::string("^" + print_type(TREE_TYPE(type)));
}
else if (is_procedure_type(type))
{

View File

@ -952,6 +952,14 @@ namespace gcc
this->current_expression = build_int_cstu(elna_word_type_node,
TYPE_ALIGN_UNIT(this->current_expression));
}
else if (expression->field() == "min" && is_integral_type(this->current_expression))
{
this->current_expression = TYPE_MIN_VALUE(this->current_expression);
}
else if (expression->field() == "max" && is_integral_type(this->current_expression))
{
this->current_expression = TYPE_MAX_VALUE(this->current_expression);
}
else
{
error_at(expression_location, "type '%s' does not have property '%s'",