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

◆ AndAlso() [2/2]

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

Definition at line 1197 of file Expression.cs.

1198 {
1199 ExpressionUtils.RequiresCanRead(left, "left");
1200 ExpressionUtils.RequiresCanRead(right, "right");
1201 Type type;
1202 if (method == null)
1203 {
1204 if (left.Type == right.Type)
1205 {
1206 if (left.Type == typeof(bool))
1207 {
1208 return new LogicalBinaryExpression(ExpressionType.AndAlso, left, right);
1209 }
1210 if (left.Type == typeof(bool?))
1211 {
1212 return new SimpleBinaryExpression(ExpressionType.AndAlso, left, right, left.Type);
1213 }
1214 }
1215 method = GetUserDefinedBinaryOperator(ExpressionType.AndAlso, left.Type, right.Type, "op_BitwiseAnd");
1216 if (method != null)
1217 {
1218 ValidateUserDefinedConditionalLogicOperator(ExpressionType.AndAlso, left.Type, right.Type, method);
1219 type = ((left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.ReturnType);
1220 return new MethodBinaryExpression(ExpressionType.AndAlso, left, right, type, method);
1221 }
1222 throw Error.BinaryOperatorNotDefined(ExpressionType.AndAlso, left.Type, right.Type);
1223 }
1224 ValidateUserDefinedConditionalLogicOperator(ExpressionType.AndAlso, left.Type, right.Type, method);
1225 type = ((left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.ReturnType);
1226 return new MethodBinaryExpression(ExpressionType.AndAlso, left, right, type, method);
1227 }
static void RequiresCanRead(Expression expression, string paramName)
static bool AreEquivalent(Type t1, Type t2)
Definition TypeUtils.cs:664
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.Dynamic.Utils.TypeUtils.AreEquivalent(), 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().