** merged revision 54585 from mcs
authorRaja R Harinath <harinath@hurrynot.org>
Mon, 19 Dec 2005 10:13:56 +0000 (10:13 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Mon, 19 Dec 2005 10:13:56 +0000 (10:13 -0000)
svn path=/trunk/mcs/; revision=54596

mcs/gmcs/ChangeLog
mcs/gmcs/namespace.cs

index 47ebb4b35dd3fee4deed897d148539472fcf1fef..d593061139814ebc99c9fa7aebd4236e2ead8092 100644 (file)
@@ -1,3 +1,17 @@
+2005-12-18 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       Fix #76995
+
+       * namespace.cs (NamespaceEntry): Add extern_aliases as a
+       ListDictionary, to contain the ExternAliasEntry entries (in
+       addition to the NamespaceEntry.aliases hashtable). This field is
+       shared between the original entry and its doppelganger (bodyless 
+       copy of it).
+       (NamespaceEntry.UsingExternalAlias): Add the extern alias entry to
+       extern_aliases field.
+       (NamespaceEntry.Lookup): Move the IsImplicit check after the
+       lookup in extern_aliases.
+
 2005-12-16  Raja R Harinath  <rharinath@novell.com>
 
        Fix #77006.
index 99d54a43ddb5893cde8c4b2f0cf6583f65faa656..39d9e395830aaf83bf62aa9f4d3597a71ab6853d 100644 (file)
@@ -421,6 +421,8 @@ namespace Mono.CSharp {
                public bool DeclarationFound = false;
                bool UsingFound;
 
+               ListDictionary extern_aliases;
+
                static ArrayList entries = new ArrayList ();
 
                public static void Reset ()
@@ -679,6 +681,12 @@ namespace Mono.CSharp {
                        if (aliases == null)
                                aliases = new Hashtable ();
                        
+                       // Share the extern_aliases field with the Doppelganger
+                       if (extern_aliases == null) {
+                               extern_aliases = new ListDictionary ();
+                               Doppelganger.extern_aliases = extern_aliases;
+                       }
+                       
                        if (aliases.Contains (name)) {
                                AliasEntry ae = (AliasEntry) aliases [name];
                                Report.SymbolRelatedToPreviousError (ae.Location, ae.Name);
@@ -692,7 +700,11 @@ namespace Mono.CSharp {
                                return;
                        }
 
-                       aliases [name] = new ExternAliasEntry (Doppelganger, name, loc);
+                       // Register the alias in aliases and extern_aliases, since we need both of them
+                       // to keep things simple (different resolution scenarios)
+                       ExternAliasEntry alias = new ExternAliasEntry (Doppelganger, name, loc);
+                       aliases [name] = alias;
+                       extern_aliases [name] = alias;
                }
 
                public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
@@ -737,11 +749,17 @@ namespace Mono.CSharp {
                        if (fne != null)
                                return fne;
 
+                       if (extern_aliases != null) {
+                               AliasEntry entry = extern_aliases [name] as AliasEntry;
+                               if (entry != null)
+                                       return entry.Resolve ();
+                       }
+                       
                        if (IsImplicit)
                                return null;
-
+                       
                        //
-                       // Check aliases.
+                       // Check aliases. 
                        //
                        if (aliases != null) {
                                AliasEntry entry = aliases [name] as AliasEntry;