From: fennecdjay Date: Thu, 26 Sep 2019 10:02:21 +0000 (+0200) Subject: :art: Use meta to check unpack X-Git-Tag: nightly~2199^2~2 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ce606e1994876486899d067a68b3c06d60137d6a;p=gwion.git :art: Use meta to check unpack --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 08c096b8..c6c618cc 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -575,8 +575,9 @@ ANN static m_bool prim_gack(const Emitter emit, const Exp_Primary* primary) { } ANN static m_bool prim_unpack(const Emitter emit NUSED, const Exp_Primary* primary) { -// TODO err_msg - return exp_self(primary)->emit_var ? GW_OK : GW_ERROR; + if(exp_self(primary)->meta == ae_meta_var) + return GW_OK; + ERR_B(exp_self(primary)->pos, _("unused Tuple unpack")) } static const _exp_func prim_func[] = { diff --git a/src/lib/tuple.c b/src/lib/tuple.c index a1f9474a..b12b5cf0 100644 --- a/src/lib/tuple.c +++ b/src/lib/tuple.c @@ -144,10 +144,10 @@ static OP_CHECK(opck_at_tuple) { DECL_OO(const Type, t, = (Type)VPTR(&bin->lhs->type->e->tuple->types, i)) e->d.exp_decl.td->xid->xid = insert_symbol(t->name); CHECK_BO(traverse_decl(env, &e->d.exp_decl)) + bin->rhs->meta = ae_meta_var; } ++i; } while((e = e->next)); - bin->rhs->emit_var = 1; return bin->lhs->type; } return opck_at_object_tuple(env, data, mut);