CHECK_BB(emit_exp_decl_non_static(emit, decl, list->self, r, var));
else
CHECK_BB(emit_exp_decl_global(emit, decl, list->self, r, var));
+ if(tflag(list->self->value->type, tflag_contract) && !exp_getvar(exp_self(decl))) {
+ const Type t = list->self->value->type;
+ struct Op_Import opi = { .lhs=t->info->base_type, .op=insert_symbol("@implicit"), .rhs=t };
+ CHECK_BB(op_emit(emit, &opi));
+ }
set_late(emit->gwion, decl, list->self);
if(GET_FLAG(array_base(v->type), abstract) && !GET_FLAG(decl->td, late) && GET_FLAG(v, late)) {
env_warn(emit->env, decl->td->pos, _("Type '%s' is abstract, use late"), v->type->name);
env->class_def = NULL;
env->func = NULL;
env->scope->depth = 0;
+ env->scope->in_try = false;
}
ANN void release_ctx(struct Env_Scope_ *a, struct Gwion_ *gwion) {
ANN m_bool check_type_def(const Env env, const Type_Def tdef) {
if(tdef->when) {
+ set_tflag(tdef->type, tflag_contract);
const Var_Decl decl = new_var_decl(env->gwion->mp, insert_symbol("self"), NULL, tdef->when->pos);
const Arg_List args = new_arg_list(env->gwion->mp, cpy_type_decl(env->gwion->mp, tdef->ext), decl, NULL);
Func_Base *fb = new_func_base(env->gwion->mp, type2td(env->gwion, tdef->type, tdef->pos),
struct Op_Import opi = { .lhs=base, .rhs=tdef->type };
op_cpy(env, &opi);
scan0_explicit_distinct(env, base, tdef->type);
-// type_addref(tdef->type); // maybe because of scope_iter in nspc_free_values
+ type_addref(tdef->type); // maybe because of scope_iter in nspc_free_values
} else
set_tflag(tdef->type, tflag_typedef);
if(global)
env_pop(env, 0);
+ tdef->type->info->base_type = base;
return GW_OK;
}