This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Fix import _ used twice in one package


This patch to the Go frontend fixes the case where a package is imported
twice, by two different source files, and the second import uses _ as
the local name.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r f3dfe292768b go/gogo.cc
--- a/go/gogo.cc	Mon Mar 07 13:19:55 2011 -0800
+++ b/go/gogo.cc	Mon Mar 07 13:26:17 2011 -0800
@@ -308,12 +308,7 @@
 	  ln = package->name();
 	  is_ln_exported = Lex::is_exported_name(ln);
 	}
-      if (ln != ".")
-	{
-	  ln = this->pack_hidden_name(ln, is_ln_exported);
-	  this->package_->bindings()->add_package(ln, package);
-	}
-      else
+      if (ln == ".")
 	{
 	  Bindings* bindings = package->bindings();
 	  for (Bindings::const_declarations_iterator p =
@@ -322,6 +317,13 @@
 	       ++p)
 	    this->add_named_object(p->second);
 	}
+      else if (ln == "_")
+	package->set_uses_sink_alias();
+      else
+	{
+	  ln = this->pack_hidden_name(ln, is_ln_exported);
+	  this->package_->bindings()->add_package(ln, package);
+	}
       return;
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]