From: fennecdjay Date: Wed, 2 Oct 2019 00:18:29 +0000 (+0200) Subject: Revert ":art: Remove pos from Implicit" X-Git-Tag: nightly~2198^2~178 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=9e2d42de488864a51718645088b338383613a855;p=gwion.git Revert ":art: Remove pos from Implicit" This reverts commit a33aea9e0ea755c26be653f0cf840a39861a2818. --- diff --git a/include/operator.h b/include/operator.h index 0e3f9500..30969337 100644 --- a/include/operator.h +++ b/include/operator.h @@ -25,6 +25,7 @@ struct Op_Import { 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*); diff --git a/src/emit/emit.c b/src/emit/emit.c index 90022be6..7f8aabf7 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1102,7 +1102,7 @@ ANN static m_bool emit_exp_unary(const Emitter emit, const Exp_Unary* unary) { ANN static m_bool emit_implicit_cast(const Emitter emit, const restrict Exp from, const restrict Type to) { - const struct Implicit imp = { .e=from, .t=to }; + const struct Implicit imp = { from, to, from->pos }; struct Op_Import opi = { .op=insert_symbol("@implicit"), .lhs=from->type, .rhs=to, .data=(m_uint)&imp }; return op_emit_bool(emit, &opi); } diff --git a/src/parse/check.c b/src/parse/check.c index ceda1a8d..d6e94243 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -30,7 +30,7 @@ ANN m_bool check_class_def(const Env env, const Class_Def class_def); ANN static m_bool _check_implicit(const Env env, const m_str str, const Exp e, const Type t) { - struct Implicit imp = { .e=e, .t=t }; + struct Implicit imp = { .e=e, .t=t, .pos=e->pos }; struct Op_Import opi = { .op=insert_symbol(str), .lhs=e->type, .rhs=t, .data=(uintptr_t)&imp, .pos=e->pos }; CHECK_OB(op_check(env, &opi)) @@ -40,7 +40,7 @@ ANN static m_bool _check_implicit(const Env env, const m_str str, ANN static m_bool check_internal(const Env env, const Symbol sym, const Exp e, const Type t) { - struct Implicit imp = { .e=e, .t=t }; + struct Implicit imp = { .e=e, .t=t, .pos=e->pos }; struct Op_Import opi = { .op=sym, .lhs=e->type, .rhs=t, .data=(uintptr_t)&imp, .pos=e->pos }; CHECK_OB(op_check(env, &opi))