Author: jbevain
Date: 2008-01-09 08:56:42 -0500 (Wed, 09 Jan 2008)
New Revision: 92504
Modified:
trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
trunk/mcs/class/System.Core/System.Linq.Expressions/Expression.cs
Log:
2008-01-09 Jb Evain <[EMAIL PROTECTED]>
* Expression.cs: make the TypeAs test pass.
Modified: trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
===================================================================
--- trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
2008-01-09 13:50:00 UTC (rev 92503)
+++ trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
2008-01-09 13:56:42 UTC (rev 92504)
@@ -1,3 +1,7 @@
+2008-01-09 Jb Evain <[EMAIL PROTECTED]>
+
+ * Expression.cs: make the TypeAs test pass.
+
2007-12-04 Marek Safar <[EMAIL PROTECTED]>
* ElementInit.cs: New implementation.
Modified: trunk/mcs/class/System.Core/System.Linq.Expressions/Expression.cs
===================================================================
--- trunk/mcs/class/System.Core/System.Linq.Expressions/Expression.cs
2008-01-09 13:50:00 UTC (rev 92503)
+++ trunk/mcs/class/System.Core/System.Linq.Expressions/Expression.cs
2008-01-09 13:56:42 UTC (rev 92504)
@@ -70,17 +70,12 @@
return type;
}
- internal static bool IsNullableType(Type type)
+ internal static bool IsNullableType (Type type)
{
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException ("type");
- if (type.IsGenericType) {
- Type genType = type.GetGenericTypeDefinition();
- return
typeof(Nullable<>).IsAssignableFrom(genType);
- }
-
- return false;
+ return type.IsGenericType &&
type.GetGenericTypeDefinition () == typeof (Nullable<>);
}
#endregion
@@ -1099,6 +1094,8 @@
throw new ArgumentNullException ("expression");
if (type == null)
throw new ArgumentNullException ("type");
+ if (type.IsValueType && !IsNullableType (type))
+ throw new ArgumentException ("Reference or
nullable type expected");
return new UnaryExpression (ExpressionType.TypeAs,
expression, type);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches