Implement .max and .min type properties

This commit is contained in:
2025-02-16 07:53:31 +01:00
parent b358f8ba27
commit 994b91e0e5
5 changed files with 290 additions and 277 deletions

View File

@ -733,6 +733,7 @@ namespace gcc
if (result)
{
TREE_PUBLIC(definition_tree) = definition->exported;
TYPE_NAME(tree_type) = get_identifier(definition->identifier.c_str());
}
else
{
@ -952,6 +953,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'",