-Subproject commit f8589bde72faa61d9552ca6fbce4a2ba541031f9
+Subproject commit 810bd99f395edf47635393d771eefd73a34f00e1
return ret;
}
-ANN Exp symbol_owned_exp(const Gwion gwion, const Symbol *data);
-ANN static m_bool emit_symbol_owned(const Emitter emit, const Symbol *data) {
- const Exp dot = symbol_owned_exp(emit->gwion, data);
- dot->info->nspc = prim_exp(data)->info->nspc;
- const m_bool ret = emit_exp_dot(emit, &dot->d.exp_dot);
- free_exp(emit->gwion->mp, dot);
- return ret;
-}
-
ANN static m_bool emit_symbol_builtin(const Emitter emit, const Symbol *data) {
const Value v = prim_self(data)->value;
if(vflag(v, vflag_direct)) {
regpushi(emit, (m_uint)actual_type(emit->gwion, v->type));
return GW_OK;
}
- if(v->from->owner_class)
- return emit_symbol_owned(emit, data);
if(vflag(v, vflag_builtin) || vflag(v, vflag_direct) || vflag(v, vflag_enum))
return emit_symbol_builtin(emit, data);
if(!strncmp(v->type->name, "@Foreach:[", 10)) {
return exists != env->gwion->type[et_error] ? exists : NULL;
struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)scan0_cdef,
.scope=env->scope->depth, .flag=tflag_scan0 };
-// CHECK_BO(envset_push(&es, t->info->owner_class, t->info->ctx ? t->info->ctx->nspc : env->curr))
-//const Nspc former = env->curr;
-//if(env->class_def)
-//const Type cdef = env->class_def;
CHECK_BO(envset_push(&es, t->info->owner_class, t->info->ctx ? t->info->ctx->nspc : env->curr))
-// CHECK_BO(envset_push(&es, t->info->owner_class, t->info->owner))
-/*{
-nspc_push_type(env->gwion->mp, env->curr);
- Type_List tl = td->types;
- do {
- nspc_add_type(env->curr, tl->td->xid, nspc_lookup_type0(former, tl->td->xid));
- } while((tl = tl->next));
-}*/
const Type ret = _scan_class(env, &info);
-//nspc_pop_type(env->gwion->mp, env->curr);
if(es.run)
envset_pop(&es, t->info->owner_class);
return ret;
}
-ANN static inline Symbol dot_symbol(SymTable *st, const Value v) {
- const m_str name = !GET_FLAG(v, static) ? "this" : v->from->owner_class->name;
- return insert_symbol(st, name);
-}
-
-ANN Exp symbol_owned_exp(const Gwion gwion, const Symbol *data) {
- const Value v = prim_self(data)->value;
- const Exp base = new_prim_id(gwion->mp, dot_symbol(gwion->st, v), loc_cpy(gwion->mp, prim_pos(data)));
- const Exp dot = new_exp_dot(gwion->mp, base, *data, loc_cpy(gwion->mp, prim_pos(data)));
- const Type owner = v->from->owner_class;
- dot->d.exp_dot.t_base = dot->d.exp_dot.base->info->type = !GET_FLAG(v, static) ?
- owner : type_class(gwion, owner);
- dot->info->type = prim_exp(data)->info->type;
- exp_setvar(dot, exp_getvar(prim_exp(data)));
- return dot;
-}
-
ANN void struct_release(const VM_Shred shred, const Type base, const m_bit *ptr) {
const Vector types = &base->info->tuple->types;
const Vector offsets = &base->info->tuple->offset;
return value;
}
-ANN Exp symbol_owned_exp(const Gwion gwion, const Symbol *data);
-
ANN static Type check_dot(const Env env, const Exp_Dot *member) {
struct Op_Import opi = { .op=insert_symbol("@dot"), .lhs=member->t_base, .data=(uintptr_t)member,
.pos=exp_self(member)->pos, .op_type=op_dot };
if(GET_FLAG(v, const))
exp_setmeta(prim_exp(data), 1);
if(v->from->owner_class) {
- const Exp exp = symbol_owned_exp(env->gwion, data);
- const Type ret = check_dot(env, &exp->d.exp_dot);
- prim_exp(data)->info->nspc = exp->info->nspc;
- free_exp(env->gwion->mp, exp);
- CHECK_OO(ret);
+ const Exp exp = exp_self(prim_exp(data));
+ const m_str name = !GET_FLAG(v, static) ? "this" : v->from->owner_class->name;
+ const Exp base = new_prim_id(env->gwion->mp, insert_symbol(name), loc_cpy(env->gwion->mp, prim_pos(data)));
+ exp->exp_type = ae_exp_dot;
+ exp->d.exp_dot.base = base;
+ exp->d.exp_dot.xid = sym;
+ return check_exp(env, exp);
}
return v->type;
}