2004-11-18 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Thu, 18 Nov 2004 06:18:05 +0000 (06:18 -0000)
committerMartin Baulig <martin@novell.com>
Thu, 18 Nov 2004 06:18:05 +0000 (06:18 -0000)
* rootcontext.cs
(RootContext.LookupType): Return a `Type', not a `TypeExpr'.

svn path=/trunk/mcs/; revision=36249

mcs/gmcs/ChangeLog
mcs/gmcs/attribute.cs
mcs/gmcs/ecore.cs
mcs/gmcs/expression.cs
mcs/gmcs/rootcontext.cs

index 0a73f86c0adc908856c1efa87563ed55c5890439..9091ef6fa1724e74e5371f3872c1522826b3e424 100755 (executable)
@@ -1,3 +1,8 @@
+2004-11-18  Martin Baulig  <martin@ximian.com>
+
+       * rootcontext.cs
+       (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
+
 2004-11-18  Martin Baulig  <martin@ximian.com>
 
        * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
index e237f6e11aec3e3b45b35c9ff9af5bedc450bf9c..fb114f648a46377cd5b911b99a56bfa9f811a762 100644 (file)
@@ -157,16 +157,16 @@ namespace Mono.CSharp {
                 /// </summary>
                protected virtual Type CheckAttributeType (EmitContext ec, bool complain)
                {
-                       TypeExpr t1 = RootContext.LookupType (ec.DeclSpace, Name, true, Location);
+                       Type t1 = RootContext.LookupType (ec.DeclSpace, Name, true, Location);
                        // FIXME: Shouldn't do this for quoted attributes: [@A]
-                       TypeExpr t2 = RootContext.LookupType (ec.DeclSpace, Name + "Attribute", true, Location);
+                       Type t2 = RootContext.LookupType (ec.DeclSpace, Name + "Attribute", true, Location);
 
                        String err0616 = null;
-                       if (t1 != null && ! t1.IsAttribute) {
+                       if (t1 != null && ! t1.IsSubclassOf (TypeManager.attribute_type)) {
                                t1 = null;
                                err0616 = "'" + Name + "': is not an attribute class";
                        }
-                       if (t2 != null && ! t2.IsAttribute) {
+                       if (t2 != null && ! t2.IsSubclassOf (TypeManager.attribute_type)) {
                                t2 = null;
                                err0616 = (err0616 != null) 
                                        ? "Neither '" + Name + "' nor '" + Name + "Attribute' is an attribute class"
@@ -179,9 +179,9 @@ namespace Mono.CSharp {
                                return null;
                        }
                        if (t1 != null)
-                               return t1.Type;
+                               return t1;
                        if (t2 != null)
-                               return t2.Type;
+                               return t2;
                        if (err0616 != null) {
                                Report.Error (616, Location, err0616);
                                return null;
index e87e3a3b41b236b3e117e02e30c0a3ff45f37533..8042516829300cc357c4a7680b9d6b380f7a9ff7 100755 (executable)
@@ -2061,7 +2061,7 @@ namespace Mono.CSharp {
                {
                        DeclSpace ds = ec.DeclSpace;
                        NamespaceEntry ns = ds.NamespaceEntry;
-                       TypeExpr t;
+                       Type t;
                        IAlias alias_value;
 
                        //
@@ -2091,18 +2091,18 @@ namespace Mono.CSharp {
                                        if (alias_value.IsType)
                                                return alias_value.ResolveAsType (ec);
                                        if ((t = RootContext.LookupType (ds, alias_value.Name, true, loc)) != null)
-                                               return t;
+                                               return new TypeExpression (t, loc);
                                }
                        }
 
                        if ((t = RootContext.LookupType (ds, Name, true, loc)) != null)
-                               return t;
+                               return new TypeExpression (t, loc);
 
                        if (alias_value != null) {
                                if (alias_value.IsType)
                                        return alias_value.ResolveAsType (ec);
                                if ((t = RootContext.LookupType (ds, alias_value.Name, true, loc)) != null)
-                                       return t;
+                                       return new TypeExpression (t, loc);
                                
                                // we have alias value, but it isn't Type, so try if it's namespace
                                return new SimpleName (alias_value.Name, loc);
@@ -2450,16 +2450,10 @@ namespace Mono.CSharp {
                protected override TypeExpr DoResolveAsTypeStep (EmitContext ec)
                {
                        if (type == null) {
-                               TypeExpr texpr = RootContext.LookupType (
+                               type = RootContext.LookupType (
                                        ec.DeclSpace, name, false, Location.Null);
-                               if (texpr == null)
+                               if (type == null)
                                        return null;
-
-                               texpr = texpr.ResolveAsTypeTerminal (ec);
-                               if (texpr == null)
-                                       return null;
-
-                               type = texpr.Type;
                        }
 
                        return this;
index 0b62b2d9fdacf8f2a2630ce1793eb2563f68963c..d613402d55486aea6c6414bff5d1aaf329ec4e4e 100755 (executable)
@@ -9038,17 +9038,9 @@ namespace Mono.CSharp {
                                //
                                // For now, fall back to the full lookup in that case.
                                //
-                               TypeExpr texpr = RootContext.LookupType (
-                                       ec.DeclSpace, cname, false, loc);
-
-                               if (texpr == null)
-                                       return null;
-
-                               texpr = texpr.ResolveAsTypeTerminal (ec);
-                               if (texpr == null)
+                               type = RootContext.LookupType (ec.DeclSpace, cname, false, loc);
+                               if (type == null)
                                        return null;
-
-                               type = texpr.Type;
                        }
 
                        if (!ec.InUnsafe && type.IsPointer){
index 1b36017b5f8b89bd41b9713689da34bcac886829..b5c15422163390bc7fc849837cfb4f1a7ae1be81 100755 (executable)
@@ -488,8 +488,7 @@ namespace Mono.CSharp {
                        return ns.Substring (0, i);
                }
 
-               static TypeExpr NamespaceLookup (DeclSpace ds, string name,
-                                                int num_type_args, Location loc)
+               static Type NamespaceLookup (DeclSpace ds, string name, int num_type_args, Location loc)
                {
                        //
                        // Try in the current namespace and all its implicit parents
@@ -503,14 +502,17 @@ namespace Mono.CSharp {
                                if (!result.IsType)
                                        return null;
 
-                               return result.ResolveAsType (ds.EmitContext);
+                               TypeExpr texpr = result.ResolveAsType (ds.EmitContext);
+                               if (texpr == null)
+                                       return null;
+
+                               return texpr.Type;
                        }
 
                        return null;
                }
                
-               static public TypeExpr LookupType (DeclSpace ds, string name, bool silent,
-                                                  Location loc)
+               static public Type LookupType (DeclSpace ds, string name, bool silent, Location loc)
                {
                        return LookupType (ds, name, silent, 0, loc);
                }
@@ -523,13 +525,13 @@ namespace Mono.CSharp {
                //
                // Come to think of it, this should be a DeclSpace
                //
-               static public TypeExpr LookupType (DeclSpace ds, string name, bool silent,
-                                                  int num_type_params, Location loc)
+               static public Type LookupType (DeclSpace ds, string name, bool silent,
+                                              int num_type_params, Location loc)
                {
-                       TypeExpr t;
+                       Type t;
 
                        if (ds.Cache.Contains (name)){
-                               t = (TypeExpr) ds.Cache [name];
+                               t = (Type) ds.Cache [name];
                                if (t != null)
                                        return t;
                        } else {
@@ -547,8 +549,7 @@ namespace Mono.CSharp {
                                                //
                                                Type type = TypeManager.LookupType (current_type.FullName + "." + name);
                                                if (type != null){
-                                                       type = ds.ResolveNestedType (type, loc);
-                                                       t = new TypeExpression (type, loc);
+                                                       t = ds.ResolveNestedType (type, loc);
                                                        ds.Cache [name] = t;
                                                        return t;
                                                }
@@ -576,7 +577,7 @@ namespace Mono.CSharp {
                //   This is the silent version of LookupType, you can use this
                //   to `probe' for a type
                // </summary>
-               static public TypeExpr LookupType (TypeContainer tc, string name, Location loc)
+               static public Type LookupType (TypeContainer tc, string name, Location loc)
                {
                        return LookupType (tc, name, true, loc);
                }