- _struct->scope = new_declaration_scope(parent_scope);
- _struct->fields = g_array_sized_new(FALSE, TRUE,
- sizeof(struct field),
- DEFAULT_NR_STRUCT_FIELDS);
- g_array_set_size(_struct->fields, struct_type->fields->len);
- for (i = 0; i < struct_type->fields->len; i++) {
- struct type_field *type_field =
- &g_array_index(struct_type->fields,
- struct type_field, i);
- struct field *field = &g_array_index(_struct->fields,
- struct field, i);
-
- field->name = type_field->name;
- field->declaration =
- type_field->type->declaration_new(type_field->type,
- _struct->scope);
- ret = register_declaration(field->name,
- field->declaration, _struct->scope);
+ _struct->p.index = index;
+ _struct->p.name = field_name;
+ _struct->p.path = new_definition_path(parent_scope, field_name);
+ _struct->scope = new_definition_scope(parent_scope, field_name);
+ _struct->fields = g_ptr_array_sized_new(DEFAULT_NR_STRUCT_FIELDS);
+ g_ptr_array_set_size(_struct->fields, struct_declaration->fields->len);
+ for (i = 0; i < struct_declaration->fields->len; i++) {
+ struct declaration_field *declaration_field =
+ &g_array_index(struct_declaration->fields,
+ struct declaration_field, i);
+ struct definition **field =
+ (struct definition **) &g_ptr_array_index(_struct->fields, i);
+
+ *field = declaration_field->declaration->definition_new(declaration_field->declaration,
+ _struct->scope,
+ declaration_field->name, i);
+ ret = register_field_definition(declaration_field->name,
+ *field,
+ _struct->scope);