]> Nishi Git Mirror - gwion.git/commitdiff
:art: Use meta to check unpack
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 26 Sep 2019 10:02:21 +0000 (12:02 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 26 Sep 2019 10:02:21 +0000 (12:02 +0200)
src/emit/emit.c
src/lib/tuple.c

index 08c096b8961cd639ccee45608fb49ec597e6ac1e..c6c618cc136d221b800a58f8461ba8fadcda95f8 100644 (file)
@@ -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[] = {
index a1f9474a49f2ba9e7438849f186f9d5b7e1b6103..b12b5cf09fcd5ef66d1823ff608e9793f659510f 100644 (file)
@@ -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);