summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2018-07-17 08:57:58 +0000
committerOri Bernstein <ori@eigenstate.org>2018-07-19 21:29:35 -0700
commitf4a43f90e3ffe1712aec13566e8ac545da4161c4 (patch)
tree57a3edcd99ff2cae6ab74b6435af32d3182174ba /mi
parent8a3e8add6e0180565312d1079395ad39de4d9ce3 (diff)
downloadmc-f4a43f90e3ffe1712aec13566e8ac545da4161c4.tar.gz
Support direct tuple access operators "tuple.N"
This patch adds tuple access expressions. If t is a tuple, its N-th component can be retrieved with the syntax t.N. Of course, the components are zero indexed. I believe the code also works if 't' is a pointer to a tuple (but I have not checked this).
Diffstat (limited to 'mi')
-rw-r--r--mi/flatten.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mi/flatten.c b/mi/flatten.c
index 5a74996..e4817d3 100644
--- a/mi/flatten.c
+++ b/mi/flatten.c
@@ -560,8 +560,9 @@ rval(Flattenctx *s, Node *n)
if (ty->type == Tyslice || ty->type == Tyarray) {
r = seqlen(s, args[0], exprtype(n));
} else {
+ case Otupmemb:
t = rval(s, args[0]);
- r = mkexpr(n->loc, Omemb, t, args[1], NULL);
+ r = mkexpr(n->loc, exprop(n), t, args[1], NULL);
r->expr.type = n->expr.type;
}
break;
@@ -696,6 +697,7 @@ lval(Flattenctx *s, Node *n)
case Ovar: r = n; break;
case Oidx: r = rval(s, n); break;
case Oderef: r = rval(s, n); break;
+ case Otupmemb: r = rval(s, n); break;
case Omemb: r = rval(s, n); break;
case Ostruct: r = rval(s, n); break;