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

◆ Power() [2/2]

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

Definition at line 2024 of file Expression.cs.

2025 {
2026 ExpressionUtils.RequiresCanRead(left, "left");
2027 ExpressionUtils.RequiresCanRead(right, "right");
2028 if (method == null)
2029 {
2030 if (!(left.Type == right.Type) || !left.Type.IsArithmetic())
2031 {
2032 string name = "op_Exponent";
2033 BinaryExpression userDefinedBinaryOperator = GetUserDefinedBinaryOperator(ExpressionType.Power, name, left, right, liftToNull: true);
2034 if (userDefinedBinaryOperator == null)
2035 {
2036 name = "op_Exponentiation";
2038 if (userDefinedBinaryOperator == null)
2039 {
2040 throw Error.BinaryOperatorNotDefined(ExpressionType.Power, left.Type, right.Type);
2041 }
2042 }
2043 ParameterInfo[] parametersCached = userDefinedBinaryOperator.Method.GetParametersCached();
2044 ValidateParamswithOperandsOrThrow(parametersCached[0].ParameterType, left.Type, ExpressionType.Power, name);
2045 ValidateParamswithOperandsOrThrow(parametersCached[1].ParameterType, right.Type, ExpressionType.Power, name);
2047 }
2048 method = CachedReflectionInfo.Math_Pow_Double_Double;
2049 }
2051 }
static void RequiresCanRead(Expression expression, string paramName)
static BinaryExpression GetUserDefinedBinaryOperator(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull)
static BinaryExpression GetMethodBasedBinaryOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, bool liftToNull)
static void ValidateParamswithOperandsOrThrow(Type paramType, Type operandType, ExpressionType exprType, string name)

References System.Linq.Expressions.Error.BinaryOperatorNotDefined(), System.Linq.Expressions.Expression< TDelegate >.GetMethodBasedBinaryOperator(), System.Linq.Expressions.Expression< TDelegate >.GetUserDefinedBinaryOperator(), System.Linq.Expressions.CachedReflectionInfo.Math_Pow_Double_Double, System.Dynamic.Utils.ExpressionUtils.RequiresCanRead(), and System.Linq.Expressions.Expression< TDelegate >.ValidateParamswithOperandsOrThrow().