struct Implicit {
Exp e;
Type t;
- loc_t pos;
};
ANN m_bool add_op(const Gwion gwion, const struct Op_Import*);
ANN Type op_check(const Env, struct Op_Import*);
ANN static m_bool emit_implicit_cast(const Emitter emit,
const restrict Exp from, const restrict Type to) {
- const struct Implicit imp = { from, to, from->pos };
+ const struct Implicit imp = { .e=from, .t=to };
struct Op_Import opi = { .op=insert_symbol("@implicit"), .lhs=from->type, .rhs=to, .data=(m_uint)&imp };
return op_emit_bool(emit, &opi);
}
emit_union_offset(udef->l, udef->o);
if(udef->xid || udef->type_xid || global)
emit_pop(emit, scope);
-puts(emit->env->name);
-// SET_FLAG(udef->xid ? udef->value->type : udef->type, emit);
return GW_OK;
}
const struct Implicit* imp = (struct Implicit*)data;
const Type l = imp->e->type;
const Type r = imp->t;
- if(check_nonnull(env, l, r, "implicitly cast", imp->pos) == env->gwion->type[et_null])
+ if(check_nonnull(env, l, r, "implicitly cast", imp->e->pos) == env->gwion->type[et_null])
return env->gwion->type[et_null];
imp->e->cast_to = r;
return imp->t;
ANN static m_bool check_implicit(const Env env, const Symbol sym,
const Exp e, const Type t) {
- struct Implicit imp = { .e=e, .t=t, .pos=e->pos };
+ struct Implicit imp = { .e=e, .t=t };
struct Op_Import opi = { .op=sym, .lhs=e->type,
.rhs=t, .data=(uintptr_t)&imp, .pos=e->pos };
CHECK_OB(op_check(env, &opi))