-Subproject commit 5bbcb7bd4c570fe76b0b868e8b1fbdf6dfa8b5f9
+Subproject commit 6dc4bc7ca452a1a44168135c7e8dcf9ebdba94f7
if (is_fptr(emit->gwion, t)) {
if (f->def->base->tmpl) tmpl_prelude(emit, f);
}
- if (fp || f != emit->env->func || !is_static ||
+ if (fp || f != emit->env->func || (!is_static && strcmp(s_name(f->def->base->xid), "new"))||
strstr(emit->code->name, "ork~")) {
const Instr instr = emit_add_instr(emit, SetCode);
instr->udata.one = 1;
v->from->offset = emit_local(emit, emit->gwion->type[et_int]);
v->d.num = i;
} else
- *(m_bit *)(emit->env->class_def->nspc->info->class_data +
+ *(m_uint *)(emit->env->class_def->nspc->info->class_data +
v->from->offset) = i;
}
+ set_tflag(edef->t, tflag_emit);
return GW_OK;
}
ANN static m_bool emit_class_def(const Emitter emit, const Class_Def cdef) {
if (tmpl_base(cdef->base.tmpl)) return GW_OK;
const Type t = cdef->base.type;
- const Class_Def c = t->info->cdef;
if (tflag(t, tflag_emit)) return GW_OK;
set_tflag(t, tflag_emit);
+ const Class_Def c = t->info->cdef;
const Type owner = t->info->value->from->owner_class;
if (owner) CHECK_BB(ensure_emit(emit, owner));
if (c->base.ext && t->info->parent->info->cdef &&
!tflag(t->info->parent, tflag_emit)) // ?????
CHECK_BB(cdef_parent(emit, c));
- nspc_allocdata(emit->gwion->mp, t->nspc);
if (c->body) {
emit_class_code(emit, t->name);
if (scanx_body(emit->env, c, (_exp_func)emit_section, emit) > 0)
}
if (!gwi->gwion->env->class_def)
GWI_ERR_B(_("import: too many class_end called."))
- nspc_allocdata(gwi->gwion->mp, gwi->gwion->env->class_def->nspc);
const Type t = gwi->gwion->env->class_def;
if (tflag(t, tflag_tmpl)) {
--gwi->tmpls;
self->d.exp_call.func = func;
self->d.exp_call.args = args;
self->d.exp_call.tmpl = NULL;
- self->d.exp_call.allow_curry = 0;
+ self->d.exp_call.allow_curry = false;
self->exp_type = ae_exp_call;
CHECK_BN(traverse_exp(env, self));
return self->type;
ANN m_bool check_implicit(const Env env, const Exp e, const Type t) {
if (e->type == t) return GW_OK;
+ if (isa(e->type, t) > 0) return GW_OK;
const Symbol sym = insert_symbol("@implicit");
return (e->cast_to = check_internal(env, sym, e, t)) ? GW_OK : GW_ERROR;
}
if (func) {
if (!is_fptr(env->gwion, func->value_ref->type)) // skip function pointers
if (func != env->func && func->def && !fflag(func, fflag_valid)) {
- // if(!fflag(func, fflag_valid)) {
struct EnvSet es = {.env = env,
.data = env,
.func = (_exp_func)check_cdef,
CHECK_BO(check_func_def(env, func->def));
if (es.run) envset_pop(&es, func->value_ref->from->owner_class);
}
+
exp->func->type = func->value_ref->type;
call_add_effect(env, func, exp->func->pos);
if (func == env->func) set_fflag(env->func, fflag_recurs);
}
}
}
+ nspc_allocdata(env->gwion->mp, t->nspc);
return GW_OK;
}
add_type(env, env->curr, t);
mk_class(env, t, edef->pos);
if (global) env_pop(env, 0);
- // scan0_implicit_similar(env, t, env->gwion->type[et_int]);
+// scan0_implicit_similar(env, t, env->gwion->type[et_int]);
+// scan0_implicit_similar(env, env->gwion->type[et_int], t);
return t;
}