summaryrefslogtreecommitdiff
path: root/parse/stab.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-24 18:46:34 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-24 18:46:34 -0800
commit3dc461b0b09aae0b89c6310fe572f1bd7f693395 (patch)
tree923ed5809bdcf00fce5321a50aefd7bdac8afd34 /parse/stab.c
parentee50a71ce18d4721e868e575d26d894bc8f13e37 (diff)
downloadmc-3dc461b0b09aae0b89c6310fe572f1bd7f693395.tar.gz
Fix importing/exporting traits.
Diffstat (limited to 'parse/stab.c')
-rw-r--r--parse/stab.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/parse/stab.c b/parse/stab.c
index 828b248..ff85026 100644
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -414,6 +414,9 @@ static int mergeimpl(Node *old, Node *new)
{
Vis vis;
+ /* extern traits should be deduped in use.c. */
+ if (old->impl.isextern && new->impl.isextern)
+ return 1;
if (old->impl.vis > new->impl.vis)
vis = old->impl.vis;
else
@@ -431,7 +434,18 @@ static int mergeimpl(Node *old, Node *new)
void putimpl(Stab *st, Node *n)
{
- Node *impl;
+ Node *impl, *name;
+ Stab *ns;
+
+ name = n->impl.traitname;
+ if (name->name.ns) {
+ ns = getns(file, name->name.ns);
+ if (!ns) {
+ ns = mkstab(0);
+ updatens(ns, name->name.ns);
+ }
+ st = ns;
+ }
impl = getimpl(st, n);
if (impl && !mergeimpl(impl, n))