2001-12-09 Radek Doulik <rodo@ximian.com>
[mono.git] / mcs / mcs / ecore.cs
index 4aca8cd8a8f2581c6fa5e09c65ce25b5401fc6c5..445d03422085c7d605273192d4cc79ece68e58f0 100755 (executable)
@@ -2456,12 +2456,13 @@ namespace Mono.CSharp {
                        // Stage 2: Lookup members
                        //
                        e = MemberLookup (ec, ec.TypeContainer.TypeBuilder, Name, true, Location);
-                       if (e == null){
+                       if (e == null) {
                                //
                                // Stage 3: Lookup symbol in the various namespaces. 
                                // 
                                Type t;
-                               
+                               string alias_value;
+
                                if ((t = ec.TypeContainer.LookupType (Name, true)) != null)
                                        return new TypeExpr (t);
 
@@ -2472,11 +2473,16 @@ namespace Mono.CSharp {
                                // Since we are cheating: we only do the Alias lookup for
                                // namespaces if the name does not include any dots in it
                                //
-                               
-                               // IMPLEMENT ME.  Read mcs/mcs/TODO for ideas, or rewrite
-                               // using NamespaceExprs (dunno how that fixes the alias
-                               // per-file though).
-                               
+
+                               if (Name.IndexOf ('.') == -1 && (alias_value = ec.TypeContainer.LookupAlias (Name)) != null) {
+                                       // System.Console.WriteLine (Name + " --> " + alias_value);
+                                       if ((t = ec.TypeContainer.LookupType (alias_value, true)) != null)
+                                               return new TypeExpr (t);
+
+                                       // we have alias value, but it isn't Type, so try if it's namespace
+                                       return new SimpleName (alias_value, Location);
+                               }
+
                                // No match, maybe our parent can compose us
                                // into something meaningful.
                                //