+
+static
+struct declaration *
+ _array_declaration_new(struct type *type,
+ struct declaration_scope *parent_scope)
+{
+ struct type_array *array_type =
+ container_of(type, struct type_array, p);
+ struct declaration_array *array;
+
+ array = g_new(struct declaration_array, 1);
+ type_ref(&array_type->p);
+ array->p.type = array_type;
+ array->p.ref = 1;
+ array->scope = new_declaration_scope(parent_scope);
+ array->current_element.declaration =
+ array_type->elem.p->declaration_new(&array_type->elem.p,
+ parent_scope);
+ return &array->p;
+}
+
+static
+void _array_declaration_free(struct declaration *declaration)
+{
+ struct type_array *array =
+ container_of(declaration, struct type_array, p);
+ struct declaration *elem_declaration =
+ array->current_element.declaration;
+
+ elem_type->p.type->declaration_free(elem_type);
+ free_declaration_scope(array->scope);
+ type_unref(array->p.type);
+ g_free(array);
+}