return AddChecked (left, right, method);
case ExpressionType.AndAlso:
return AndAlso (left, right);
+ case ExpressionType.ArrayIndex:
+ return ArrayIndex (left, right);
case ExpressionType.Coalesce:
return Coalesce (left, right, conversion);
case ExpressionType.Divide:
if (method == null)
return null;
- if (!method.IsGenericMethod && args == null)
+ if (!method.IsGenericMethod && (args == null || args.Length == 0))
return method;
if (args.Length == method.GetGenericArguments ().Length)
static bool IsConvertiblePrimitive (Type type)
{
var t = type.GetNotNullableType ();
-
+
if (t == typeof (bool))
return false;
if (type.IsInterface || target.IsInterface)
return true;
+ if (type.IsEnum && target == typeof (Enum))
+ return true;
+
if (type.IsValueType || target.IsValueType)
return false;
throw new ArgumentNullException ("expression");
if (!expression.Type.IsAssignableTo (propertyAccessor.DeclaringType))
throw new ArgumentException ("expression");
- } else if (expression != null)
- throw new ArgumentException ("expression");
+ }
+ //
+ // .NET does not mandate that if the property is static, that the expression must be null
+ // fixes a bug exposed by Orchard's ContentItemRecordAlteration.Alteration
+ // else if (expression != null)
+ // throw new ArgumentException ("expression");
var prop = GetAssociatedProperty (propertyAccessor);
if (prop == null)
// 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
}
}