ref: d619645586593515ab9b589f97006975c5fa3d5e
parent: e92ebbba27581d60d697ce774387fb86a33c55f7
author: Ori Bernstein <[email protected]>
date: Wed Oct 15 12:05:07 EDT 2014
Add array and tuples to decision trees.
--- a/opt/match.c
+++ b/opt/match.c
@@ -87,6 +87,24 @@
return sub;
}
+static Dtree *addtup(Dtree *t, Node *pat, Node ***cap, size_t *ncap)
+{
+ size_t i;
+
+ for (i = 0; i < pat->expr.nargs; i++)
+ t = addpat(t, pat->expr.args[i], cap, ncap);
+ return t;
+}
+
+static Dtree *addarr(Dtree *t, Node *pat, Node ***cap, size_t *ncap)
+{
+ size_t i;
+
+ for (i = 0; i < pat->expr.nargs; i++)
+ t = addpat(t, pat->expr.args[i], cap, ncap);
+ return t;
+}
+
static Dtree *addpat(Dtree *t, Node *pat, Node ***cap, size_t *ncap)
{
Dtree *ret;
@@ -103,7 +121,6 @@
case Olit:
ret = addlit(t, pat, cap, ncap);
break;
- /*
case Otup:
ret = addtup(t, pat, cap, ncap);
break;
@@ -110,7 +127,6 @@
case Oarr:
ret = addarr(t, pat, cap, ncap);
break;
- */
default:
/* Right now, we just use this code for warning.
*