enum vflag {
vflag_none = 1 << 0,
vflag_func = 1 << 1,
- vflag_union = 1 << 2,
- vflag_enum = 1 << 3,
- vflag_freeme = 1 << 4,
- vflag_fglobal = 1 << 5,
- vflag_valid = 1 << 6,
- vflag_direct = 1 << 7,
- vflag_builtin = 1 << 8,
- vflag_member = 1 << 9,
- vflag_closed = 1 << 10
+ vflag_fglobal = 1 << 2,
+ vflag_valid = 1 << 3,
+ vflag_direct = 1 << 4,
+ vflag_builtin = 1 << 5,
+ vflag_member = 1 << 6,
+ vflag_closed = 1 << 7
// vflag_used = 1 << 3
} __attribute__((packed));
regpushi(emit, (m_uint)actual_type(emit->gwion, v->type));
return GW_OK;
}
- if(vflag(v, vflag_builtin) || vflag(v, vflag_direct) || vflag(v, vflag_enum))
+ if(vflag(v, vflag_builtin) || vflag(v, vflag_direct))
return emit_symbol_builtin(emit, data);
if(!strncmp(v->type->name, "@Foreach:[", 10)) {
if(exp_getvar(exp_self(prim_self(data)))) {
}
ANN static inline void nspc_release_object(const Nspc a, Value value, Gwion gwion) {
- if(!vflag(value, vflag_union) && ((GET_FLAG(value, static) && a->info->class_data) ||
- (value->d.ptr && vflag(value, vflag_builtin)))) {
+ if((GET_FLAG(value, static) && a->info->class_data) ||
+ (value->d.ptr && vflag(value, vflag_builtin))) {
const M_Object obj = value->d.ptr ? (M_Object)value->d.ptr :
*(M_Object*)(a->info->class_data + value->from->offset);
release(obj, gwion->vm->cleaner_shred);
}
ANN2(1,3) static inline void nspc_release_struct(const Nspc a, Value value, Gwion gwion) {
- if(value && !vflag(value, vflag_union) && ((GET_FLAG(value, static) && a->info->class_data) ||
+ if(value && ((GET_FLAG(value, static) && a->info->class_data) ||
(vflag(value, vflag_builtin) && value->d.ptr))) {
const m_bit *ptr = (value && value->d.ptr) ? (m_bit*)value->d.ptr:
(m_bit*)(a->info->class_data + value->from->offset);
struct scope_iter iter = { t->nspc->info->value, 0, 0 };\
Value v;
while(scope_iter(&iter, &v) > 0) {
- if(!GET_FLAG(v, static) && !vflag(v, vflag_union) &&
- isa(v->type, shred->info->vm->gwion->type[et_object]) > 0)
- release(*(M_Object*)(o->data + v->from->offset), shred);
- else if(tflag(v->type, tflag_struct) &&
- !GET_FLAG(v, static) && !vflag(v, vflag_union) && v->type->info->tuple) {
- const TupleForm tf = v->type->info->tuple;
- for(m_uint i = 0; i < vector_size(&tf->types); ++i) {
- const m_bit *data = o->data + v->from->offset;
- const Type t = (Type)vector_at(&tf->types, i);
- if(isa(t, shred->info->vm->gwion->type[et_object]) > 0)
- release(*(M_Object*)(data + vector_at(&tf->offset, i)), shred);
- }
- }
+ if(!GET_FLAG(v, static) && isa(v->type, shred->info->vm->gwion->type[et_compound]) > 0)
+ compound_release(shred, v->type, o->data + v->from->offset);
}
}
if(tflag(t, tflag_dtor) && t->nspc->dtor) {
SET_FLAG(v, static);
SET_ACCESS(edef, v)
SET_ACCESS(edef, edef->t)
- }
+ } else
+ set_vflag(v, vflag_builtin);
SET_FLAG(v, const);
set_vflag(v, vflag_valid);
- set_vflag(v, vflag_enum);
nspc_add_value(edef->t->info->owner, list->xid, v);
vector_add(&edef->values, (vtype)v);
} while((list = list->next));