From cd2ee0c97348444779a155909b7ec78d89cfd2e0 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 19 Jul 2026 03:00:59 +0200 Subject: Remove old record syntax --- gcc/gcc/elna-generic.cc | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'gcc') 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& arguments) - { - vec *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& 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 *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; } -- cgit v1.2.3