aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc/elna-generic.cc27
1 files changed, 10 insertions, 17 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc
index 0516f5a..ae04be9 100644
--- a/gcc/gcc/elna-generic.cc
+++ b/gcc/gcc/elna-generic.cc
@@ -60,20 +60,6 @@ namespace elna::gcc
procedure_address, vec_safe_length(argument_trees), vec_safe_address(argument_trees));
}
- void generic_visitor::build_record_call(location_t, tree symbol,
- const std::vector<boot::expression *>& arguments)
- {
- vec<constructor_elt, va_gc> *tree_arguments = nullptr;
- tree record_fields = TYPE_FIELDS(symbol);
- for (boot::expression *const argument : arguments)
- {
- argument->accept(this);
- CONSTRUCTOR_APPEND_ELT(tree_arguments, record_fields, this->current_expression);
- record_fields = TREE_CHAIN(record_fields);
- }
- this->current_expression = build_constructor(symbol, tree_arguments);
- }
-
void generic_visitor::build_assert_builtin(location_t call_location,
const std::vector<boot::expression *>& arguments)
{
@@ -139,9 +125,16 @@ namespace elna::gcc
? this->current_expression
: TREE_TYPE(this->current_expression);
- if (TREE_CODE(expression_type) == RECORD_TYPE)
+ if (TREE_CODE(expression_type) == RECORD_TYPE
+ && TYPE_NAME(expression_type) == get_identifier("String"))
{
- build_record_call(call_location, expression_type, call->arguments);
+ vec<constructor_elt, va_gc> *elms = nullptr;
+
+ call->arguments.at(0)->accept(this);
+ CONSTRUCTOR_APPEND_ELT(elms, elna_string_ptr_field_node, this->current_expression);
+ call->arguments.at(1)->accept(this);
+ CONSTRUCTOR_APPEND_ELT(elms, elna_string_length_field_node, this->current_expression);
+ this->current_expression = build_constructor(elna_string_type_node, elms);
}
else if (TREE_CODE(expression_type) == FUNCTION_TYPE)
{
@@ -155,7 +148,7 @@ namespace elna::gcc
}
else
{
- error_at(call_location, "'%s' cannot be called, it is neither a procedure nor record",
+ error_at(call_location, "'%s' cannot be called, it is not a procedure",
print_type(expression_type).c_str());
this->current_expression = error_mark_node;
}