ref: 3ff4453f5f5898a7b44d47218945d4385c2f5c32
parent: 26ac18e94d9f64f5153c51cf6d6151367ea0dfd7
author: Ori Bernstein <[email protected]>
date: Sun Oct 22 16:13:02 EDT 2017
Propagate hiddenness properly across usefile merges.
--- a/parse/export.c
+++ b/parse/export.c
@@ -272,6 +272,7 @@
tr->aux[i]->vis = tr->vis;
for (i = 0; i < tr->nproto; i++) {
tr->proto[i]->decl.vis = tr->vis;
+ printf("leaving %s with vis %d\n", declname(tr->proto[i]), tr->vis);
tagnode(st, tr->proto[i], 0, hidelocal);
}
}
@@ -287,7 +288,7 @@
tr = s->impl.trait;
tagtrait(st, tr, 0, hidelocal);
for (j = 0; j < tr->naux; j++)
- tr->aux[j]->vis = Visexport;
+ tr->aux[j]->vis = tr->vis;
}
free(k);
--- a/parse/node.c
+++ b/parse/node.c
@@ -553,8 +553,6 @@
void
setns(Node *n, char *ns)
{
- assert(!ns || !n->name.ns || !strcmp(n->name.ns, ns));
-
if (!ns)
return;
n->name.ns = strdup(ns);
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -505,12 +505,18 @@
static int
mergetrait(Trait *old, Trait *new)
{
+ int hidden;
+
+ hidden = old->ishidden && new->ishidden;
if (old->isproto && !new->isproto)
*old = *new;
else if (new->isproto && !old->isproto)
*new = *old;
else if (!new->isimport && !old->isimport)
- return new->vis == Vishidden || old->vis == Vishidden;
+ if (new->vis == Vishidden || old->vis == Vishidden)
+ return 0;
+ new->ishidden = hidden;
+ old->ishidden = hidden;
return 1;
}