Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UnaryOperationBinder.cs
Go to the documentation of this file.
3
4namespace System.Dynamic;
5
7{
8 public sealed override Type ReturnType
9 {
10 get
11 {
12 ExpressionType operation = Operation;
13 if ((uint)(operation - 83) <= 1u)
14 {
15 return typeof(bool);
16 }
17 return typeof(object);
18 }
19 }
20
21 public ExpressionType Operation { get; }
22
23 internal sealed override bool IsStandardBinder => true;
24
26 {
27 ContractUtils.Requires(OperationIsValid(operation), "operation");
28 Operation = operation;
29 }
30
32 {
33 return FallbackUnaryOperation(target, null);
34 }
35
37
38 public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[]? args)
39 {
40 ContractUtils.RequiresNotNull(target, "target");
41 ContractUtils.Requires(args == null || args.Length == 0, "args");
42 return target.BindUnaryOperation(this);
43 }
44
45 internal static bool OperationIsValid(ExpressionType operation)
46 {
47 switch (operation)
48 {
49 case ExpressionType.Negate:
50 case ExpressionType.UnaryPlus:
51 case ExpressionType.Not:
52 case ExpressionType.Decrement:
53 case ExpressionType.Extension:
54 case ExpressionType.Increment:
55 case ExpressionType.OnesComplement:
56 case ExpressionType.IsTrue:
57 case ExpressionType.IsFalse:
58 return true;
59 default:
60 return false;
61 }
62 }
63}
virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder)
override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[]? args)
DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target)
DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject? errorSuggestion)
UnaryOperationBinder(ExpressionType operation)
static bool OperationIsValid(ExpressionType operation)
static void Requires([DoesNotReturnIf(false)] bool precondition, string paramName)
static void RequiresNotNull(object value, string paramName)