internal static BinaryExpression Create(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression conversion)
{
Debug.Assert(nodeType != ExpressionType.Assign);
if (conversion != null)
{
Debug.Assert(method == null && TypeUtils.AreEquivalent(type, right.Type) && nodeType == ExpressionType.Coalesce);
return new CoalesceConversionBinaryExpression(left, right, conversion);
}
if (method != null)
{
return new MethodBinaryExpression(nodeType, left, right, type, method);
}
if (type == typeof(bool))
{
return new LogicalBinaryExpression(nodeType, left, right);
}
return new SimpleBinaryExpression(nodeType, left, right, type);
}