private static BinaryExpression GetMethodBasedAssignOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, LambdaExpression conversion, bool liftToNull)
{
BinaryExpression b = GetMethodBasedBinaryOperator(binaryType, left, right, method, liftToNull);
if (conversion == null)
{
// return type must be assignable back to the left type
if (!TypeUtils.AreReferenceAssignable(left.Type, b.Type))
{
throw Error.UserDefinedOpMustHaveValidReturnType(binaryType, b.Method.Name);
}
}
else
{
// add the conversion to the result
ValidateOpAssignConversionLambda(conversion, b.Left, b.Method, b.NodeType);
b = new OpAssignMethodConversionBinaryExpression(b.NodeType, b.Left, b.Right, b.Left.Type, b.Method, conversion);
}
return b;
}