Use faster invariant conversion
[mono.git] / mcs / class / System.Core / System.Linq.Expressions / Expression.cs
index ed9af3c6e18120126145297968e345ccab89ab54..8106c60f47d2607cc8ef501c40d95438fc5e6deb 100644 (file)
@@ -1183,7 +1183,7 @@ namespace System.Linq.Expressions {
                static bool IsConvertiblePrimitive (Type type)
                {
                        var t = type.GetNotNullableType ();
-
+       
                        if (t == typeof (bool))
                                return false;
 
@@ -1221,6 +1221,9 @@ namespace System.Linq.Expressions {
                        if (type.IsInterface || target.IsInterface)
                                return true;
 
+                       if (type.IsEnum && target == typeof (Enum))
+                               return true;
+
                        if (type.IsValueType || target.IsValueType)
                                return false;
 
@@ -1330,7 +1333,7 @@ namespace System.Linq.Expressions {
                                throw new ArgumentNullException ("addMethod");
                        if (arguments == null)
                                throw new ArgumentNullException ("arguments");
-                       if (addMethod.Name.ToLower (CultureInfo.InvariantCulture) != "add")
+                       if (addMethod.Name.ToLowerInvariant () != "add")
                                throw new ArgumentException ("addMethod");
                        if (addMethod.IsStatic)
                                throw new ArgumentException ("addMethod must be an instance method", "addMethod");
@@ -1710,7 +1713,7 @@ namespace System.Linq.Expressions {
                        var inits = CheckListInit (newExpression, initializers);
 
                        if (addMethod != null) {
-                               if (addMethod.Name.ToLower (CultureInfo.InvariantCulture) != "add")
+                               if (addMethod.Name.ToLowerInvariant () != "add")
                                        throw new ArgumentException ("addMethod");
 
                                var parameters = addMethod.GetParameters ();
@@ -2265,9 +2268,11 @@ namespace System.Linq.Expressions {
                // This method must be overwritten by derived classes to
                // compile the expression
                //
+#if !FULL_AOT_RUNTIME
                internal virtual void Emit (EmitContext ec)
                {
                        throw new NotImplementedException (String.Format ("Emit method is not implemented in expression type {0}", GetType ()));
                }
+#endif
        }
 }