+
+static
+struct type_array *_array_type_new(struct type_class *type_class,
+ struct declaration_scope *parent_scope)
+{
+ struct type_class_array *array_class =
+ container_of(type_class, struct type_class_array, p);
+ struct type_array *array;
+
+ array = g_new(struct type_array, 1);
+ type_class_ref(&array_class->p);
+ array->p._class = array_class;
+ array->p.ref = 1;
+ array->scope = new_declaration_scope(parent_scope);
+ array->current_element.type =
+ array_class->elem.p->type_new(&array_class->elem.p,
+ parent_scope);
+ return &array->p;
+}
+
+static
+void _array_type_free(struct type *type)
+{
+ struct type_array *array =
+ container_of(type, struct type_array, p);
+ struct type *elem_type = array->current_element.type;
+
+ elem_type->p._class->type_free(elem_type);
+ free_declaration_scope(array->scope);
+ type_class_unref(array->p._class);
+ g_free(array);
+}