From ce606e1994876486899d067a68b3c06d60137d6a Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Thu, 26 Sep 2019 12:02:21 +0200 Subject: [PATCH] :art: Use meta to check unpack --- src/emit/emit.c | 5 +++-- src/lib/tuple.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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); -- 2.43.0