ANN static m_bool emit_exp_unary(const Emitter emit, const Exp_Unary* unary) {
// no pos ?
+ const Type t = exp_self(unary)->info->type;
+ if(t->e->def && !GET_FLAG(t, emit))
+ CHECK_BB(ensure_emit(emit, t))
struct Op_Import opi = { .op=unary->op, .data=(uintptr_t)unary, .op_type=op_unary };
if(unary->op != insert_symbol("spork") && unary->op != insert_symbol("fork") && unary->exp) {
CHECK_BB(emit_exp_pop_next(emit, unary->exp))
ANN Type type_copy(MemPool p, const Type type) {
const Type a = new_type(p, type->xid, type->name, type->e->parent);
- a->nspc = type->nspc;
+ a->nspc = type->nspc;
a->e->owner = type->e->owner;
a->e->owner_class = type->e->owner_class;
- a->size = type->size;
- a->e->d.base_type = type->e->d.base_type;
- a->array_depth = type->array_depth;
- a->e->def = type->e->def;
- a->e->gack = type->e->gack;
+ a->size = type->size;
+ a->e->d.base_type = type->e->d.base_type;
+ a->array_depth = type->array_depth;
+ a->e->gack = type->e->gack;
return a;
}
return envset_run(&es, t);
}
+ANN static inline m_bool ensure_traverse(const Env env, const Type t) {
+ struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)traverse_cdef,
+ .scope=env->scope->depth, .flag=ae_flag_check };
+ return envset_run(&es, t);
+}
+
ANN static inline m_bool inferable(const Env env, const Type t, const loc_t pos) {
if(!GET_FLAG(t, infer))
return GW_OK;
.data=(uintptr_t)unary, .pos=exp_self(unary)->pos, .op_type=op_unary };
if(unary->exp && !opi.rhs)
return NULL;
- return op_check(env, &opi);
+ DECL_OO(const Type, ret, = op_check(env, &opi))
+ const Type t = get_type(actual_type(env->gwion, ret));
+ if(t->e->def && !GET_FLAG(t, check))
+ CHECK_BO(ensure_traverse(env, t))
+ return ret;
}
ANN static Type _flow(const Env env, const Exp e, const m_bool b) {