Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ OrElse() [2/2]

static BinaryExpression System.Linq.Expressions.Expression< TDelegate >.OrElse ( Expression< TDelegate > left,
Expression< TDelegate > right,
MethodInfo? method )
inlinestaticinherited

Definition at line 1234 of file Expression.cs.

1235 {
1236 ExpressionUtils.RequiresCanRead(left, "left");
1237 ExpressionUtils.RequiresCanRead(right, "right");
1238 Type type;
1239 if (method == null)
1240 {
1241 if (left.Type == right.Type)
1242 {
1243 if (left.Type == typeof(bool))
1244 {
1245 return new LogicalBinaryExpression(ExpressionType.OrElse, left, right);
1246 }
1247 if (left.Type == typeof(bool?))
1248 {
1249 return new SimpleBinaryExpression(ExpressionType.OrElse, left, right, left.Type);
1250 }
1251 }
1252 method = GetUserDefinedBinaryOperator(ExpressionType.OrElse, left.Type, right.Type, "op_BitwiseOr");
1253 if (method != null)
1254 {
1256 type = ((left.Type.IsNullableType() && method.ReturnType == left.Type.GetNonNullableType()) ? left.Type : method.ReturnType);
1257 return new MethodBinaryExpression(ExpressionType.OrElse, left, right, type, method);
1258 }
1259 throw Error.BinaryOperatorNotDefined(ExpressionType.OrElse, left.Type, right.Type);
1260 }
1262 type = ((left.Type.IsNullableType() && method.ReturnType == left.Type.GetNonNullableType()) ? left.Type : method.ReturnType);
1263 return new MethodBinaryExpression(ExpressionType.OrElse, left, right, type, method);
1264 }
static void RequiresCanRead(Expression expression, string paramName)
static BinaryExpression GetUserDefinedBinaryOperator(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull)
static void ValidateUserDefinedConditionalLogicOperator(ExpressionType nodeType, Type left, Type right, MethodInfo method)

References System.Linq.Expressions.Error.BinaryOperatorNotDefined(), System.Linq.Expressions.Expression< TDelegate >.GetUserDefinedBinaryOperator(), System.Dynamic.Utils.ExpressionUtils.RequiresCanRead(), System.type, and System.Linq.Expressions.Expression< TDelegate >.ValidateUserDefinedConditionalLogicOperator().