ANN Type tuple_type(const Env, const Vector, const loc_t);
ANN void tuple_info(const Env, const Value);
ANN2(1) TupleForm new_tupleform(MemPool p, const Type parent_type);
-ANN void free_tupleform(const TupleForm tuple);
+ANN void free_tupleform(const TupleForm tuple, const struct Gwion_ *gwion);
#ifdef __INSTR
INSTR(TupleCtor);
ANN void tuple_info(const Env env, const Value v) {
const m_uint offset = vector_back(&env->class_def->e->tuple->offset);
+ ADD_REF(v->type);
vector_add(&env->class_def->e->tuple->types, (vtype)v->type);
vector_add(&env->class_def->e->tuple->offset, offset + v->type->size);
}
return tuple;
}
-ANN void free_tupleform(const TupleForm tuple) {
+ANN void free_tupleform(const TupleForm tuple, const struct Gwion_ *gwion) {
+ for(m_uint i = 0; i < vector_size(&tuple->types); ++i)
+ REM_REF((Type)vector_at(&tuple->types, i), (void*)gwion);
vector_release(&tuple->types);
vector_release(&tuple->offset);
}
if(a->nspc)
REM_REF(a->nspc, gwion);
if(a->e->tuple)
- free_tupleform(a->e->tuple);
+ free_tupleform(a->e->tuple, gwion);
mp_free(gwion->mp, TypeInfo, a->e);
mp_free(gwion->mp, Type, a);
}
ANN Type array_base(Type type) {
const Type t = typedef_base(type);
- return t->e->d.base_type;
+ return t->array_depth ? t->e->d.base_type : t;
}
ANN static Symbol array_sym(const Env env, const Type src, const m_uint depth) {
ANN static m_bool typedef_complex(const Env env, const Type_Def tdef, const Type base) {
const ae_flag flag = base->e->def ? base->e->def->flag : 0;
- const Class_Def cdef = new_class_def(env->gwion->mp, flag, tdef->xid, tdef->ext, NULL,
- loc_cpy(env->gwion->mp, td_pos(tdef->ext)));
+ const Class_Def cdef = new_class_def(env->gwion->mp, flag, tdef->xid,
+ cpy_type_decl(env->gwion->mp, tdef->ext), NULL,
+ loc_cpy(env->gwion->mp, td_pos(tdef->ext)));
CHECK_BB(scan0_class_def(env, cdef))
tdef->type = cdef->base.type;
cdef->base.tmpl = tdef->tmpl;// check cpy