summaryrefslogtreecommitdiff
path: root/parse/stab.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-29 00:19:22 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-29 00:19:22 -0700
commit5c7910da4770a4495e90eb5c243993ec778d4e68 (patch)
tree054bd0e3ac65e62913b5538b2abb5362da7314f3 /parse/stab.c
parentc8c4b88ecadf05438561c05f97500e35843218c4 (diff)
downloadmc-5c7910da4770a4495e90eb5c243993ec778d4e68.tar.gz
Complain about missing trait impls.
Because exploding with an abort is confusing for the user.
Diffstat (limited to 'parse/stab.c')
-rw-r--r--parse/stab.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse/stab.c b/parse/stab.c
index a17efeb..8e273ab 100644
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -373,12 +373,17 @@ void putucon(Stab *st, Ucon *uc)
static int mergetrait(Trait *old, Trait *new)
{
+ Vis vis;
+
+ vis = max(old->vis, new->vis);
if (old->isproto && !new->isproto)
*old = *new;
else if (new->isproto && !old->isproto)
*new = *old;
else
return 0;
+ old->vis = vis;
+ new->vis = vis;
return 1;
}
@@ -403,12 +408,17 @@ void puttrait(Stab *st, Node *n, Trait *c)
static int mergeimpl(Node *old, Node *new)
{
+ Vis vis;
+
+ vis = max(old->impl.vis, new->impl.vis);
if (old->impl.isproto && !new->impl.isproto)
*old = *new;
else if (new->impl.isproto && !old->impl.isproto)
*new = *old;
else
return 0;
+ old->impl.vis = vis;
+ new->impl.vis = vis;
return 1;
}