aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc/elna-generic.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc
index 30dd68b..5749bbc 100644
--- a/gcc/gcc/elna-generic.cc
+++ b/gcc/gcc/elna-generic.cc
@@ -178,6 +178,30 @@ namespace elna::gcc
}
}
+ void generic_visitor::visit(boot::record_constructor_expression *expression)
+ {
+ tree type_decl = this->symbols->lookup(expression->type_name);
+
+ if (type_decl == NULL_TREE)
+ {
+ error_at(get_location(&expression->position()), "Type '%s' not declared",
+ expression->type_name.c_str());
+ this->current_expression = error_mark_node;
+ return;
+ }
+ tree record_type = TREE_TYPE(type_decl);
+ vec<constructor_elt, va_gc> *tree_arguments = nullptr;
+
+ for (const boot::field_initializer& initializer : expression->field_initializers)
+ {
+ tree field_decl = find_field_by_name(get_location(&expression->position()),
+ record_type, initializer.name);
+ initializer.value->accept(this);
+ CONSTRUCTOR_APPEND_ELT(tree_arguments, field_decl, this->current_expression);
+ }
+ this->current_expression = build_constructor(record_type, tree_arguments);
+ }
+
void generic_visitor::visit(boot::unit *unit)
{
for (boot::import_declaration *const declaration : unit->imports)