summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-02 16:11:54 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-02 16:11:54 -0700
commit290709fdfc3fa92e84f9f2bf214c6a144f24c5ee (patch)
tree4d61591c8231c21807599b84541d0e790216b3c6 /parse/gram.y
parent987d3f2938a42db4285417109fed8d4a82655676 (diff)
downloadmc-290709fdfc3fa92e84f9f2bf214c6a144f24c5ee.tar.gz
Unjank trait resolution.
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y20
1 files changed, 2 insertions, 18 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 9dc198d..f96cea6 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -31,7 +31,6 @@ int yylex(void);
static Op binop(int toktype);
static Node *mkpseudodecl(Srcloc l, Type *t);
static void installucons(Stab *st, Type *t);
-static void addtrait(Type *t, char *str);
static void setattrs(Node *dcl, char **attrs, size_t nattrs);
static void setupinit(Node *n);
@@ -499,13 +498,13 @@ generictype
: Ttyparam {$$ = mktyparam($1->loc, $1->id);}
| Ttyparam Twith name {
$$ = mktyparam($1->loc, $1->id);
- addtrait($$, $3->name.name);
+ lappend(&$$->traits, &$$->ntraits, $3);
}
| Ttyparam Twith Toparen typaramlist Tcparen {
size_t i;
$$ = mktyparam($1->loc, $1->id);
for (i = 0; i < $4.nn; i++)
- addtrait($$, $4.nl[i]->name.name);
+ lappend(&$$->traits, &$$->ntraits, $4.nl[i]);
}
;
@@ -1077,21 +1076,6 @@ static void setupinit(Node *n)
n->decl.name->name.name = strdup(s);
}
-static void addtrait(Type *t, char *str)
-{
- size_t i;
-
- for (i = 0; i < ntraittab; i++) {
- if (!strcmp(namestr(traittab[i]->name), str)) {
- if (!t->trneed)
- t->trneed = mkbs();
- bsput(t->trneed, i);
- return;
- }
- }
- lfatal(t->loc, "Constraint %s does not exist", str);
-}
-
static Node *mkpseudodecl(Srcloc l, Type *t)
{
static int nextpseudoid;