path: root/6/simp.c
diff options
authorQuentin Carbonneaux <>2018-07-17 08:57:58 +0000
committerOri Bernstein <>2018-07-19 21:29:35 -0700
commitf4a43f90e3ffe1712aec13566e8ac545da4161c4 (patch)
tree57a3edcd99ff2cae6ab74b6435af32d3182174ba /6/simp.c
parent8a3e8add6e0180565312d1079395ad39de4d9ce3 (diff)
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 '6/simp.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/6/simp.c b/6/simp.c
index 457227e..7ab6f15 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -540,6 +540,7 @@ lval(Simp *s, Node *n)
case Ovar: r = loadvar(s, n, NULL); break;
case Oidx: r = loadidx(s, args[0], args[1]); break;
case Oderef: r = deref(rval(s, args[0], NULL), NULL); break;
+ case Otupmemb: r = rval(s, n, NULL); break;
case Omemb: r = rval(s, n, NULL); break;
case Ostruct: r = rval(s, n, NULL); break;
case Oucon: r = rval(s, n, NULL); break;
@@ -1137,8 +1138,7 @@ rval(Simp *s, Node *n, Node *dst)
u = idxaddr(s, t, n->expr.args[1]);
r = load(u);
- /* array.len slice.len are magic 'virtual' members.
- * they need to be special cased. */
+ case Otupmemb:
case Omemb:
t = membaddr(s, n);
r = load(t);