summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-03-09 14:12:40 -0800
committerOri Bernstein <ori@markovcorp.com>2017-03-09 14:12:40 -0800
commit1c97ea922511b71d925dc4e4c7823d5c67b709ba (patch)
tree50275556c7c3cf890d365570fbe5ab8e4565a98e
parent7a78ce12338f623cb53a78e3568b86bf67bf1ea1 (diff)
downloadmc-1c97ea922511b71d925dc4e4c7823d5c67b709ba.tar.gz
Put ucons into the right namespace.
Transitive includes used to go into the wrong place sometimes.
-rw-r--r--parse/use.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/parse/use.c b/parse/use.c
index 28132bd..94a1e7e 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -879,7 +879,7 @@ int loaduse(char *path, FILE *f, Stab *st, Vis vis)
int v;
char *pkg;
Node *dcl, *impl, *init;
- Stab *s;
+ Stab *s, *ns;
Type *ty;
Trait *tr;
char *lib;
@@ -985,10 +985,14 @@ foundextlib:
if (!gettype(s, ty->name) && !ty->ishidden)
puttype(s, ty->name, ty);
} else if (ty->type == Tyunion) {
- for (i = 0; i < ty->nmemb; i++)
- if (!getucon(s, ty->udecls[i]->name) &&
- !ty->udecls[i]->synth)
- putucon(s, ty->udecls[i]);
+ for (i = 0; i < ty->nmemb; i++) {
+ ns = findstab(s, ty->udecls[i]->name->name.ns);
+ if (getucon(ns, ty->udecls[i]->name))
+ continue;
+ if (ty->udecls[i]->synth)
+ continue;
+ putucon(ns, ty->udecls[i]);
+ }
}
break;
case 'I':