* ecore.cs (IAlias): New public interface.
(TypeExpr, TypeExpression): Implement IAlias.
(TypeAliasExpression): New public class.
* namespace.cs (Namespace): Implement IAlias.
(Namespace.Lookup): Return an IAlias instead on an object.
(Namespace.DefineName): Take an IAlias instead of an object.
(NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
an object.
(NamespaceEntry.UsingAlias): Take a Membername instead of an
Expression.
(NamespaceEntry.LookupAlias): Return an IAlias instead on an
object.
(NamespaceEntry.Lookup): Likewise.
* rootcontext.cs (RootContext.LookupType): Return a TypeExpr
instead of a Type.
* decl.cs (DeclSpace): Implement IAlias.
(DeclSpace.LookupAlias): Return an IAlias instead of a string.
* generic.cs (ConstructedType): Improved error checking.
svn path=/trunk/mcs/; revision=24980
+2004-04-02 Martin Baulig <martin@ximian.com>
+
+ * ecore.cs (IAlias): New public interface.
+ (TypeExpr, TypeExpression): Implement IAlias.
+ (TypeAliasExpression): New public class.
+
+ * namespace.cs (Namespace): Implement IAlias.
+ (Namespace.Lookup): Return an IAlias instead on an object.
+ (Namespace.DefineName): Take an IAlias instead of an object.
+ (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
+ an object.
+ (NamespaceEntry.UsingAlias): Take a Membername instead of an
+ Expression.
+ (NamespaceEntry.LookupAlias): Return an IAlias instead on an
+ object.
+ (NamespaceEntry.Lookup): Likewise.
+
+ * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
+ instead of a Type.
+
+ * decl.cs (DeclSpace): Implement IAlias.
+ (DeclSpace.LookupAlias): Return an IAlias instead of a string.
+
+ * generic.cs (ConstructedType): Improved error checking.
+
2004-04-02 Martin Baulig <martin@ximian.com>
* convert.cs: Added type parameter conversions.
(UnboxCast.Emit): Emit an `unbox.any' for type params.
(ClassCast.Emit): If the source type is a type parameter, box it.
If the target type is a type parameter, emit an `unbox.any'
- instead of a `classcast'.
+ instead of a `classcast'.1
2004-04-01 Martin Baulig <martin@ximian.com>
-// -*- coding: dos -*-
+// -*- coding: dos -*-\r
//\r
// attribute.cs: Attribute Handler\r
//\r
/// Tries to resolve the type of the attribute. Flags an error if it can't.\r
/// </summary>\r
private Type CheckAttributeType (EmitContext ec) {\r
- Type t;\r
+ TypeExpr t;\r
bool isattributeclass = true;\r
\r
t = RootContext.LookupType (ec.DeclSpace, Name, true, Location);\r
if (t != null) {\r
- isattributeclass = t.IsSubclassOf (TypeManager.attribute_type);\r
+ isattributeclass = t.IsAttribute;\r
if (isattributeclass)\r
- return t;\r
+ return t.ResolveType (ec);\r
}\r
t = RootContext.LookupType (ec.DeclSpace, Name + "Attribute", true, Location);\r
if (t != null) {\r
- if (t.IsSubclassOf (TypeManager.attribute_type))\r
- return t;\r
+ if (t.IsAttribute)\r
+ return t.ResolveType (ec);\r
}\r
if (!isattributeclass) {\r
Report.Error (616, Location, "'" + Name + "': is not an attribute class");\r
else\r
return false;\r
} else if (element is Property || element is Indexer ||\r
- element is Accessor) {
+ element is Accessor) {\r
if ((targets & AttributeTargets.Property) != 0)\r
return true;\r
else\r
return false;\r
- } else if (element is AssemblyClass){
+ } else if (element is AssemblyClass){\r
if ((targets & AttributeTargets.Assembly) != 0)\r
return true;\r
else\r
return false;\r
- } else if (element is ModuleClass){
- if ((targets & AttributeTargets.Module) != 0)
- return true;
- else
- return false;
+ } else if (element is ModuleClass){\r
+ if ((targets & AttributeTargets.Module) != 0)\r
+ return true;\r
+ else\r
+ return false;\r
}\r
\r
return false;\r
return;\r
}\r
\r
- if (kind is IAttributeSupport) {
- if (attr_type == TypeManager.methodimpl_attr_type && a.ImplOptions == MethodImplOptions.InternalCall) {
- ((MethodBuilder) builder).SetImplementationFlags (MethodImplAttributes.InternalCall | MethodImplAttributes.Runtime);
- }
- else {
- IAttributeSupport attributeSupport = kind as IAttributeSupport;
- attributeSupport.SetCustomAttribute (cb);
- }
- }
+ if (kind is IAttributeSupport) {\r
+ if (attr_type == TypeManager.methodimpl_attr_type && a.ImplOptions == MethodImplOptions.InternalCall) {\r
+ ((MethodBuilder) builder).SetImplementationFlags (MethodImplAttributes.InternalCall | MethodImplAttributes.Runtime);\r
+ } \r
+ else {\r
+ IAttributeSupport attributeSupport = kind as IAttributeSupport;\r
+ attributeSupport.SetCustomAttribute (cb);\r
+ }\r
+ }\r
else if (kind is Method || kind is Operator || kind is Accessor) {\r
if (attr_type == TypeManager.methodimpl_attr_type) {\r
if (a.ImplOptions == MethodImplOptions.InternalCall)\r
((FieldBuilder) builder).SetCustomAttribute (cb);\r
}\r
} else if (kind is Property || kind is Indexer) {\r
-
- if (builder is PropertyBuilder)
+\r
+ if (builder is PropertyBuilder) \r
((PropertyBuilder) builder).SetCustomAttribute (cb);\r
- //
- // This is for the case we are setting attributes on
- // the get and set accessors
- //
- else if (builder is MethodBuilder)
- ((MethodBuilder) builder).SetCustomAttribute (cb);
+ //\r
+ // This is for the case we are setting attributes on\r
+ // the get and set accessors\r
+ //\r
+ else if (builder is MethodBuilder)\r
+ ((MethodBuilder) builder).SetCustomAttribute (cb);\r
} else if (kind is Event) {\r
((MyEventBuilder) builder).SetCustomAttribute (cb);\r
} else if (kind is ParameterBuilder) {\r
return false;\r
}\r
}\r
-
- public interface IAttributeSupport {
- void SetCustomAttribute (CustomAttributeBuilder customBuilder);
- }
+\r
+ public interface IAttributeSupport {\r
+ void SetCustomAttribute (CustomAttributeBuilder customBuilder);\r
+ }\r
}\r
Class pclass = Parent as Class;
if (pclass != null) {
string pname = null;
- Type ptype = null;
+ TypeExpr ptype = null;
Type t = pclass.TypeBuilder.BaseType;
while ((t != null) && (ptype == null)) {
pname = t.FullName + "." + Basename;
: USING IDENTIFIER ASSIGN
namespace_or_type_name SEMICOLON
{
- Expression expr = ((MemberName) $4).GetTypeExpression (lexer.Location);
- current_namespace.UsingAlias ((string) $2, expr, lexer.Location);
+ current_namespace.UsingAlias ((string) $2, (MemberName) $4, lexer.Location);
}
| USING error {
CheckIdentifierToken (yyToken);
return Name;
}
+ public int CountTypeArguments {
+ get {
+ if (TypeArguments == null)
+ return 0;
+ else
+ return TypeArguments.Count;
+ }
+ }
+
public string GetFullName ()
{
string full_name;
/// provides the common foundation for managing those name
/// spaces.
/// </remarks>
- public abstract class DeclSpace : MemberCore {
+ public abstract class DeclSpace : MemberCore, IAlias {
/// <summary>
/// This points to the actual definition that is being
/// created with System.Reflection.Emit
/// <summary>
/// Looks up the alias for the name
/// </summary>
- public string LookupAlias (string name)
+ public IAlias LookupAlias (string name)
{
if (NamespaceEntry != null)
return NamespaceEntry.LookupAlias (name);
return t;
}
- public static void Error_AmbiguousTypeReference (Location loc, string name, Type t1, Type t2)
+ public static void Error_AmbiguousTypeReference (Location loc, string name, string t1, string t2)
{
Report.Error (104, loc,
- String.Format ("`{0}' is an ambiguous reference ({1} or {2}) ", name,
- t1.FullName, t2.FullName));
+ "`{0}' is an ambiguous reference ({1} or {2})",
+ name, t1, t2);
}
public Type FindNestedType (Location loc, string name,
TypeManager.CheckGeneric (match, num_type_args)) {
if (t != null){
if (CheckAccessLevel (match)) {
- Error_AmbiguousTypeReference (loc, name, t, match);
+ Error_AmbiguousTypeReference (loc, name, t.FullName, match.FullName);
return null;
}
continue;
return null;
}
+
+ bool IAlias.IsType {
+ get { return true; }
+ }
+
+ string IAlias.Name {
+ get { return Name; }
+ }
+
+ TypeExpr IAlias.Type
+ {
+ get {
+ if (TypeBuilder == null)
+ throw new InvalidOperationException ();
+
+ if (CurrentType != null)
+ return CurrentType;
+
+ return new TypeExpression (TypeBuilder, Location);
+ }
+ }
}
/// <summary>
void AddressOf (EmitContext ec, AddressOp mode);
}
+ /// <summary>
+ /// We are either a namespace or a type.
+ /// If we're a type, `IsType' is true and we may use `Type' to get
+ /// a TypeExpr representing that type.
+ /// </summary>
+ public interface IAlias {
+ bool IsType {
+ get;
+ }
+
+ string Name {
+ get;
+ }
+
+ TypeExpr Type {
+ get;
+ }
+ }
+
/// <summary>
/// This interface is implemented by variables
/// </summary>
{
DeclSpace ds = ec.DeclSpace;
NamespaceEntry ns = ds.NamespaceEntry;
- Type t;
- string alias_value;
+ TypeExpr t;
+ IAlias alias_value;
//
// Since we are cheating: we only do the Alias lookup for
return new TypeExpression (dt, loc);
if (alias_value != null){
- if ((t = RootContext.LookupType (ds, alias_value, true, NumTypeArguments, loc)) != null)
- return new TypeExpression (t, loc);
+ if (alias_value.IsType)
+ return alias_value.Type;
+ if ((t = RootContext.LookupType (ds, alias_value.Name, true, NumTypeArguments, loc)) != null)
+ return t;
}
}
// First, the using aliases
//
if (alias_value != null){
- if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
- return new TypeExpression (t, loc);
+ if (alias_value.IsType)
+ return alias_value.Type;
+ if ((t = RootContext.LookupType (ds, alias_value.Name, true, loc)) != null)
+ return t;
// we have alias value, but it isn't Type, so try if it's namespace
- return new SimpleName (alias_value, loc);
+ return new SimpleName (alias_value.Name, loc);
}
//
//
if ((t = RootContext.LookupType (ds, Name, true, NumTypeArguments, loc)) != null)
- return new TypeExpression (t, loc);
+ return t;
// No match, maybe our parent can compose us
// into something meaningful.
//
NamespaceEntry ns = ec.DeclSpace.NamespaceEntry;
if (is_base && ns != null){
- string alias_value = ns.LookupAlias (Name);
+ IAlias alias_value = ns.LookupAlias (Name);
if (alias_value != null){
- Name = alias_value;
+ if (alias_value.IsType)
+ return alias_value.Type;
+
+ Name = alias_value.Name;
Type t;
if ((t = TypeManager.LookupType (Name)) != null)
/// <summary>
/// Fully resolved expression that evaluates to a type
/// </summary>
- public abstract class TypeExpr : Expression {
+ public abstract class TypeExpr : Expression, IAlias {
override public Expression ResolveAsTypeStep (EmitContext ec)
{
TypeExpr t = DoResolveAsTypeStep (ec);
{
return Name;
}
+
+ bool IAlias.IsType {
+ get { return true; }
+ }
+
+ TypeExpr IAlias.Type {
+ get {
+ return this;
+ }
+ }
}
- public class TypeExpression : TypeExpr {
+ public class TypeExpression : TypeExpr, IAlias {
public TypeExpression (Type t, Location l)
{
Type = t;
return Type.ToString ();
}
}
+
+ string IAlias.Name {
+ get {
+ return Type.FullName;
+ }
+ }
}
/// <summary>
public override TypeExpr DoResolveAsTypeStep (EmitContext ec)
{
- if (type == null)
- type = RootContext.LookupType (ec.DeclSpace, name, false, Location.Null);
+ if (type == null) {
+ TypeExpr texpr = RootContext.LookupType (
+ ec.DeclSpace, name, false, Location.Null);
+ if (texpr == null)
+ return null;
+
+ type = texpr.ResolveType (ec);
+ if (type == null)
+ return null;
+ }
+
return this;
}
}
}
+ public class TypeAliasExpression : TypeExpr, IAlias {
+ TypeExpr texpr;
+ TypeArguments args;
+ string name;
+
+ public TypeAliasExpression (TypeExpr texpr, TypeArguments args, Location l)
+ {
+ this.texpr = texpr;
+ this.args = args;
+ loc = texpr.Location;
+
+ eclass = ExprClass.Type;
+ if (args != null)
+ name = texpr.Name + "<" + args.ToString () + ">";
+ else
+ name = texpr.Name;
+ }
+
+ public override string Name {
+ get { return name; }
+ }
+
+ public override TypeExpr DoResolveAsTypeStep (EmitContext ec)
+ {
+ Type type = texpr.ResolveType (ec);
+ if (type == null)
+ return null;
+
+ int num_args = TypeManager.GetNumberOfTypeArguments (type);
+
+ if (args != null) {
+ if (num_args == 0) {
+ Report.Error (308, loc,
+ "The non-generic type `{0}' cannot " +
+ "be used with type arguments.",
+ TypeManager.CSharpName (type));
+ return null;
+ }
+
+ ConstructedType ctype = new ConstructedType (type, args, loc);
+ return ctype.ResolveAsTypeTerminal (ec);
+ } else if (num_args > 0) {
+ Report.Error (305, loc,
+ "Using the generic type `{0}' " +
+ "requires {1} type arguments",
+ TypeManager.GetFullName (type), num_args);
+ return null;
+ }
+
+ return new TypeExpression (type, loc);
+ }
+
+ public override Type ResolveType (EmitContext ec)
+ {
+ TypeExpr t = ResolveAsTypeTerminal (ec);
+ if (t == null)
+ return null;
+
+ type = t.ResolveType (ec);
+ return type;
+ }
+
+ public override bool CheckAccessLevel (DeclSpace ds)
+ {
+ return texpr.CheckAccessLevel (ds);
+ }
+
+ public override bool AsAccessible (DeclSpace ds, int flags)
+ {
+ return texpr.AsAccessible (ds, flags);
+ }
+
+ public override bool IsClass {
+ get { return texpr.IsClass; }
+ }
+
+ public override bool IsValueType {
+ get { return texpr.IsValueType; }
+ }
+
+ public override bool IsInterface {
+ get { return texpr.IsInterface; }
+ }
+
+ public override bool IsSealed {
+ get { return texpr.IsSealed; }
+ }
+
+ public override bool IsAttribute {
+ get { return texpr.IsAttribute; }
+ }
+ }
+
/// <summary>
/// MethodGroup Expression.
///
SimpleName sn = (SimpleName) left_original;
- Type t = RootContext.LookupType (ec.DeclSpace, sn.Name, true, loc);
+ TypeExpr t = RootContext.LookupType (ec.DeclSpace, sn.Name, true, loc);
if (t != null)
return true;
//
// For now, fall back to the full lookup in that case.
//
- type = RootContext.LookupType (
+ TypeExpr texpr = RootContext.LookupType (
ec.DeclSpace, cname, false, loc);
+ if (texpr == null)
+ return null;
+
+ type = texpr.ResolveType (ec);
if (type == null)
return null;
}
return this;
}
+ Type t;
+ int num_args;
+
SimpleName sn = new SimpleName (name, args.Count, loc);
TypeExpr resolved = sn.ResolveAsTypeTerminal (ec);
if (resolved == null) {
return null;
}
- Type t = resolved.Type;
- int num_args = TypeManager.GetNumberOfTypeArguments (t);
+ t = resolved.Type;
+ num_args = TypeManager.GetNumberOfTypeArguments (t);
if (num_args == 0) {
Report.Error (308, loc,
return null;
}
- if (resolved.Type == null)
- throw new InternalErrorException (
- "Failed to resolve constructed type `{0}'",
- full_name);
+ t = resolved.Type;
+ if (t == null) {
+ Report.Error (246, loc, "Cannot find type `{0}'", full_name);
+ return null;
+ }
+
+ num_args = TypeManager.GetNumberOfTypeArguments (t);
+ if (num_args == 0) {
+ Report.Error (308, loc,
+ "The non-generic type `{0}' cannot " +
+ "be used with type arguments.",
+ TypeManager.CSharpName (t));
+ return null;
+ }
- gt = resolved.Type.GetGenericTypeDefinition ();
+ gt = t.GetGenericTypeDefinition ();
return this;
}
atypes = args.Arguments;
if (atypes.Length != gen_params.Length) {
- Report.Error (-217, loc, "Generic type `{0}' takes {1} " +
- "type parameters, but specified {2}.", gt.Name,
- gen_params.Length, atypes.Length);
+ Report.Error (305, loc,
+ "Using the generic type `{0}' " +
+ "requires {1} type arguments",
+ TypeManager.GetFullName (gt),
+ gen_params.Length);
return null;
}
/// <summary>
/// Keeps track of the namespaces defined in the C# code.
/// </summary>
- public class Namespace {
+ public class Namespace : IAlias {
static ArrayList all_namespaces = new ArrayList ();
static Hashtable namespaces_map = new Hashtable ();
return Root.GetNamespace (name, create);
}
- public object Lookup (DeclSpace ds, string name)
+ public IAlias Lookup (DeclSpace ds, string name, Location loc)
{
- object o = Lookup (name);
+ IAlias o = Lookup (name);
Type t;
DeclSpace tdecl = o as DeclSpace;
t = tdecl.DefineType ();
if ((ds == null) || ds.CheckAccessLevel (t))
- return t;
+ return new TypeExpression (t, loc);
}
Namespace ns = GetNamespace (name, false);
if ((t == null) || ((ds != null) && !ds.CheckAccessLevel (t)))
return null;
- return t;
+ return new TypeExpression (t, loc);
}
public void AddNamespaceEntry (NamespaceEntry entry)
entries.Add (entry);
}
- public void DefineName (string name, object o)
+ public void DefineName (string name, IAlias o)
{
defined_names.Add (name, o);
}
- public object Lookup (string name)
+ public IAlias Lookup (string name)
{
- return defined_names [name];
+ return (IAlias) defined_names [name];
}
static public ArrayList UserDefinedNamespaces {
else
return String.Format ("Namespace ({0})", Name);
}
+
+ bool IAlias.IsType {
+ get { return false; }
+ }
+
+ TypeExpr IAlias.Type {
+ get {
+ throw new InvalidOperationException ();
+ }
+ }
}
public class NamespaceEntry
public class AliasEntry {
public readonly string Name;
- public readonly Expression Alias;
+ public readonly MemberName Alias;
public readonly NamespaceEntry NamespaceEntry;
public readonly Location Location;
- public AliasEntry (NamespaceEntry entry, string name, Expression alias, Location loc)
+ public AliasEntry (NamespaceEntry entry, string name, MemberName alias, Location loc)
{
Name = name;
Alias = alias;
Location = loc;
}
- object resolved;
+ IAlias resolved;
- public object Resolve ()
+ public IAlias Resolve ()
{
if (resolved != null)
return resolved;
// this will fail with `using A = Stack<int>'
//
- string alias = Alias.ToString ();
+ string alias = Alias.GetMemberName ();
while ((curr_ns != null) && (resolved == null)) {
- resolved = curr_ns.Lookup (null, alias, Location);
+ resolved = curr_ns.Lookup (
+ null, alias, Alias.CountTypeArguments,
+ Location);
if (resolved == null)
curr_ns = curr_ns.Parent;
}
+ if (resolved == null)
+ return null;
+
+ if (resolved.IsType)
+ resolved = new TypeAliasExpression (
+ resolved.Type, Alias.TypeArguments, Location);
+
return resolved;
}
}
}
}
- public void DefineName (string name, object o)
+ public void DefineName (string name, IAlias o)
{
ns.DefineName (name, o);
}
using_clauses.Add (ue);
}
- public void UsingAlias (string alias, Expression namespace_or_type, Location loc)
+ public void UsingAlias (string name, MemberName alias, Location loc)
{
if (aliases == null)
aliases = new Hashtable ();
-
- if (aliases.Contains (alias)){
- Report.Error (1537, loc, "The using alias `" + alias +
+
+ if (aliases.Contains (name)){
+ Report.Error (1537, loc, "The using alias `" + name +
"' appeared previously in this namespace");
return;
}
- aliases [alias] = new AliasEntry (this, alias, namespace_or_type, loc);
+ aliases [name] = new AliasEntry (this, name, alias, loc);
}
protected AliasEntry GetAliasEntry (string alias)
return entry;
}
- public string LookupAlias (string alias)
+ public IAlias LookupAlias (string alias)
{
AliasEntry entry = GetAliasEntry (alias);
if (entry == null)
return null;
- object resolved = entry.Resolve ();
- if (resolved == null)
- return null;
- else if (resolved is Namespace)
- return ((Namespace) resolved).Name;
- else
- return ((Type) resolved).FullName;
+ return entry.Resolve ();
}
- public object Lookup (DeclSpace ds, string name, Location loc)
+ public IAlias Lookup (DeclSpace ds, string name, int num_type_params,
+ Location loc)
{
- object o;
+ IAlias o;
Namespace ns;
//
string first = name.Substring (0, pos);
string last = name.Substring (pos + 1);
- o = Lookup (ds, first, loc);
+ o = Lookup (ds, first, 0, loc);
if (o == null)
return null;
ns = o as Namespace;
- if (ns != null)
- return ns.Lookup (ds, last);
+ if (ns != null) {
+ o = ns.Lookup (ds, last, loc);
+ return o;
+ }
- Type nested = TypeManager.LookupType ((((Type) o).Name + "." + last));
+ Type nested = TypeManager.LookupType (o.Name + "." + last);
if ((nested == null) || ((ds != null) && !ds.CheckAccessLevel (nested)))
return null;
- return nested;
+ return new TypeExpression (nested, loc);
}
//
// Check whether it's a namespace.
//
- o = NS.Lookup (ds, name);
+ o = NS.Lookup (ds, name, loc);
if (o != null)
return o;
//
AliasEntry entry = GetAliasEntry (name);
if (entry != null) {
- o = entry.Resolve ();
- if (o != null)
- return o;
+ IAlias alias = entry.Resolve ();
+ if (alias != null)
+ return alias;
}
//
// Check using entries.
//
- Type t = null, match = null;
+ IAlias t = null, match = null;
foreach (Namespace using_ns in GetUsingTable ()) {
- match = using_ns.Lookup (ds, name) as Type;
- if (match != null){
+ match = using_ns.Lookup (ds, name, loc);
+ if ((match != null) && match.IsType){
if (t != null) {
- DeclSpace.Error_AmbiguousTypeReference (loc, name, t, match);
+ DeclSpace.Error_AmbiguousTypeReference (loc, name, t.Name, match.Name);
return null;
} else {
t = match;
return ns.Substring (0, i);
}
- static Type NamespaceLookup (DeclSpace ds, string name,
- int num_type_args, Location loc)
+ static TypeExpr NamespaceLookup (DeclSpace ds, string name,
+ int num_type_args, Location loc)
{
//
// Try in the current namespace and all its implicit parents
//
for (NamespaceEntry ns = ds.NamespaceEntry; ns != null; ns = ns.ImplicitParent) {
- object result = ns.Lookup (ds, name, loc);
+ IAlias result = ns.Lookup (ds, name, num_type_args, loc);
+
if (result == null)
continue;
- Type t = result as Type;
- if (t != null) {
- if (TypeManager.CheckGeneric (t, num_type_args))
- return t;
- else
- continue;
- }
+ if (!result.IsType)
+ return null;
- return null;
+ return result.Type;
}
return null;
}
- static public Type LookupType (DeclSpace ds, string name, bool silent,
- Location loc)
+ static public TypeExpr LookupType (DeclSpace ds, string name, bool silent,
+ Location loc)
{
return LookupType (ds, name, silent, 0, loc);
}
//
// Come to think of it, this should be a DeclSpace
//
- static public Type LookupType (DeclSpace ds, string name, bool silent,
- int num_type_params, Location loc)
+ static public TypeExpr LookupType (DeclSpace ds, string name, bool silent,
+ int num_type_params, Location loc)
{
- Type t;
+ TypeExpr t;
if (ds.Cache.Contains (name)){
- t = (Type) ds.Cache [name];
+ t = (TypeExpr) ds.Cache [name];
if (t != null)
return t;
} else {
//
// nested class
//
- t = TypeManager.LookupType (current_type.FullName + "." + name);
- if (t != null){
+ Type type = TypeManager.LookupType (current_type.FullName + "." + name);
+ if (type != null){
+ t = new TypeExpression (type, loc);
ds.Cache [name] = t;
return t;
}
// This is the silent version of LookupType, you can use this
// to `probe' for a type
// </summary>
- static public Type LookupType (TypeContainer tc, string name, Location loc)
+ static public TypeExpr LookupType (TypeContainer tc, string name, Location loc)
{
return LookupType (tc, name, true, loc);
}