public static BinaryExpression OrAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
{
RequiresCanRead(left, nameof(left));
RequiresCanWrite(left, nameof(left));
RequiresCanRead(right, nameof(right));
if (method == null)
{
if (left.Type == right.Type && left.Type.IsIntegerOrBool())
{
// conversion is not supported for binary ops on arithmetic types without operator overloading
if (conversion != null)
{
throw Error.ConversionIsNotSupportedForArithmeticTypes();
}
return new SimpleBinaryExpression(ExpressionType.OrAssign, left, right, left.Type);
}
return GetUserDefinedAssignOperatorOrThrow(ExpressionType.OrAssign, "op_BitwiseOr", left, right, conversion, liftToNull: true);
}
return GetMethodBasedAssignOperator(ExpressionType.OrAssign, left, right, method, conversion, liftToNull: true);
}