From 9ff7d81bba5cff46df7c1a486b671c40ee4ea352 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 1 Oct 2019 23:05:18 +0200 Subject: [PATCH] :art: Remove pos from Implicit --- include/operator.h | 1 - src/emit/emit.c | 4 +--- src/lib/object.c | 2 +- src/parse/check.c | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/operator.h b/include/operator.h index f401301d..c3b0abdc 100644 --- a/include/operator.h +++ b/include/operator.h @@ -19,7 +19,6 @@ 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 7f8aabf7..568a533e 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 = { 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); } @@ -1424,8 +1424,6 @@ ANN static m_bool emit_union_def(const Emitter emit, const Union_Def udef) { 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; } diff --git a/src/lib/object.c b/src/lib/object.c index 14da66cc..1ab09dfe 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -198,7 +198,7 @@ static OP_CHECK(opck_implicit_null2obj) { 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; diff --git a/src/parse/check.c b/src/parse/check.c index 17e34fbb..21b79e2b 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 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)) -- 2.43.0