shithub: mc

Download patch

ref: 1c97ea922511b71d925dc4e4c7823d5c67b709ba
parent: 7a78ce12338f623cb53a78e3568b86bf67bf1ea1
author: Ori Bernstein <ori@markovcorp.com>
date: Thu Mar 9 09:12:40 EST 2017

Put ucons into the right namespace.

	Transitive includes used to go into the wrong place
	sometimes.

--- a/parse/use.c
+++ b/parse/use.c
@@ -879,7 +879,7 @@
 	int v;
 	char *pkg;
 	Node *dcl, *impl, *init;
-	Stab *s;
+	Stab *s, *ns;
 	Type *ty;
 	Trait *tr;
 	char *lib;
@@ -985,10 +985,14 @@
 				  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':