Beispiel #1
0
 private static BinaryExpression GetUserDefinedAssignOperatorOrThrow(ExpressionType binaryType, string name, Expression left, Expression right, LambdaExpression conversion, bool liftToNull)
 {
     BinaryExpression b = GetUserDefinedBinaryOperatorOrThrow(binaryType, name, left, right, 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;
 }