summaryrefslogtreecommitdiff
path: root/parse/use.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-02-07 01:52:10 -0800
committerOri Bernstein <ori@eigenstate.org>2016-02-07 01:52:10 -0800
commit8f1e28d8625c561b91e39757e452ca6fa221fd59 (patch)
treead6353fb8137529a0e01cb532f982147f18e8943 /parse/use.c
parent0e0424af35ab5ee7ae4d7c49937a648757fe3672 (diff)
downloadmc-8f1e28d8625c561b91e39757e452ca6fa221fd59.tar.gz
Don't double init generic impls.
It's possible for a generic to be serialized twice. If we've already added an impl for a type, don't double it.
Diffstat (limited to 'parse/use.c')
-rw-r--r--parse/use.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/parse/use.c b/parse/use.c
index 2033fa7..3ab6ff5 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -821,9 +821,10 @@ static void protomap(Trait *tr, Type *ty, Node *dcl)
protoname = declname(proto);
len = strlen(protoname);
p = strstr(dclname, protoname);
- if (!p || p[len] != '$') {
+ if (!p || p[len] != '$')
+ continue;
+ if (hthas(proto->decl.impls, ty))
continue;
- }
htput(proto->decl.impls, ty, dcl);
if (ty->type == Tygeneric || hasparams(ty)) {
lappend(&proto->decl.gimpl, &proto->decl.ngimpl, dcl);