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

◆ GetMethodBasedUnaryOperator()

static UnaryExpression System.Linq.Expressions.Expression< TDelegate >.GetMethodBasedUnaryOperator ( ExpressionType unaryType,
Expression< TDelegate > operand,
MethodInfo method )
inlinestaticprivateinherited

Definition at line 5055 of file Expression.cs.

5056 {
5058 ParameterInfo[] parametersCached = method.GetParametersCached();
5059 if (parametersCached.Length != 1)
5060 {
5061 throw Error.IncorrectNumberOfMethodCallArguments(method, "method");
5062 }
5064 {
5066 return new UnaryExpression(unaryType, operand, method.ReturnType, method);
5067 }
5068 if (operand.Type.IsNullableType() && ParameterIsAssignable(parametersCached[0], operand.Type.GetNonNullableType()) && method.ReturnType.IsValueType && !method.ReturnType.IsNullableType())
5069 {
5070 return new UnaryExpression(unaryType, operand, method.ReturnType.GetNullableType(), method);
5071 }
5072 throw Error.OperandTypesDoNotMatchParameters(unaryType, method.Name);
5073 }
static void ValidateParamswithOperandsOrThrow(Type paramType, Type operandType, ExpressionType exprType, string name)
static void ValidateOperator(MethodInfo method)
static bool ParameterIsAssignable(ParameterInfo pi, Type argType)

References System.Linq.Expressions.Error.IncorrectNumberOfMethodCallArguments(), System.Linq.Expressions.Error.OperandTypesDoNotMatchParameters(), System.Linq.Expressions.Expression< TDelegate >.ParameterIsAssignable(), System.Linq.Expressions.Expression< TDelegate >.ValidateOperator(), and System.Linq.Expressions.Expression< TDelegate >.ValidateParamswithOperandsOrThrow().

Referenced by System.Linq.Expressions.Expression< TDelegate >.Decrement(), System.Linq.Expressions.Expression< TDelegate >.Increment(), System.Linq.Expressions.Expression< TDelegate >.IsFalse(), System.Linq.Expressions.Expression< TDelegate >.IsTrue(), System.Linq.Expressions.Expression< TDelegate >.MakeOpAssignUnary(), System.Linq.Expressions.Expression< TDelegate >.Negate(), System.Linq.Expressions.Expression< TDelegate >.NegateChecked(), System.Linq.Expressions.Expression< TDelegate >.Not(), System.Linq.Expressions.Expression< TDelegate >.OnesComplement(), and System.Linq.Expressions.Expression< TDelegate >.UnaryPlus().