Author: martin
Date: 2005-02-26 14:10:46 -0500 (Sat, 26 Feb 2005)
New Revision: 41242
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/expression.cs
Log:
2005-02-26 Martin Baulig <[EMAIL PROTECTED]>
* expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
begin with a "?", for instance "?[]". Don't do a type lookup if
`dim' is empty.
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-02-26 17:59:50 UTC (rev 41241)
+++ trunk/mcs/gmcs/ChangeLog 2005-02-26 19:10:46 UTC (rev 41242)
@@ -1,3 +1,9 @@
+2005-02-26 Martin Baulig <[EMAIL PROTECTED]>
+
+ * expression.cs (ComposedCast.DoResolveAsTypeStep): Allow `dim' to
+ begin with a "?", for instance "?[]". Don't do a type lookup if
+ `dim' is empty.
+
2005-02-25 Martin Baulig <[EMAIL PROTECTED]>
The first part of Nullable Types :-)
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-02-26 17:59:50 UTC (rev 41241)
+++ trunk/mcs/gmcs/expression.cs 2005-02-26 19:10:46 UTC (rev 41242)
@@ -8802,8 +8802,10 @@
return null;
}
- if (dim == "?") {
- NullableType nullable = new NullableType (left,
loc);
+ if ((dim.Length > 0) && (dim [0] == '?')) {
+ TypeExpr nullable = new NullableType (left,
loc);
+ if (dim.Length > 1)
+ nullable = new ComposedCast (nullable,
dim.Substring (1), loc);
return nullable.ResolveAsTypeTerminal (ec);
}
@@ -8836,25 +8838,29 @@
return this;
}
- //
- // ltype.Fullname is already fully qualified, so we can
skip
- // a lot of probes, and go directly to
TypeManager.LookupType
- //
- string fname = ltype.FullName != null ? ltype.FullName
: ltype.Name;
- string cname = fname + dim;
- type = TypeManager.LookupTypeDirect (cname);
- if (type == null){
+ if (dim != "") {
//
- // For arrays of enumerations we are having a
problem
- // with the direct lookup. Need to investigate.
+ // ltype.Fullname is already fully qualified,
so we can skip
+ // a lot of probes, and go directly to
TypeManager.LookupType
//
- // For now, fall back to the full lookup in
that case.
- //
- FullNamedExpression e = ec.DeclSpace.LookupType
(cname, false, loc);
- if (e is TypeExpr)
- type = ((TypeExpr) e).ResolveType (ec);
- if (type == null)
- return null;
+ string fname = ltype.FullName != null ?
ltype.FullName : ltype.Name;
+ string cname = fname + dim;
+ type = TypeManager.LookupTypeDirect (cname);
+ if (type == null){
+ //
+ // For arrays of enumerations we are
having a problem
+ // with the direct lookup. Need to
investigate.
+ //
+ // For now, fall back to the full
lookup in that case.
+ //
+ FullNamedExpression e =
ec.DeclSpace.LookupType (cname, false, loc);
+ if (e is TypeExpr)
+ type = ((TypeExpr)
e).ResolveType (ec);
+ if (type == null)
+ return null;
+ }
+ } else {
+ type = ltype;
}
if (!ec.InUnsafe && type.IsPointer){
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches