Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ParameterExpression.cs
Go to the documentation of this file.
3
5
6[DebuggerTypeProxy(typeof(ParameterExpressionProxy))]
8{
9 public override Type Type => typeof(object);
10
11 public sealed override ExpressionType NodeType => ExpressionType.Parameter;
12
13 public string? Name { get; }
14
15 public bool IsByRef => GetIsByRef();
16
17 internal ParameterExpression(string name)
18 {
19 Name = name;
20 }
21
22 internal static ParameterExpression Make(Type type, string name, bool isByRef)
23 {
24 if (isByRef)
25 {
26 return new ByRefParameterExpression(type, name);
27 }
28 if (!type.IsEnum)
29 {
30 switch (type.GetTypeCode())
31 {
32 case TypeCode.Boolean:
34 case TypeCode.Byte:
36 case TypeCode.Char:
38 case TypeCode.DateTime:
40 case TypeCode.Decimal:
42 case TypeCode.Double:
44 case TypeCode.Int16:
46 case TypeCode.Int32:
47 return new PrimitiveParameterExpression<int>(name);
48 case TypeCode.Int64:
50 case TypeCode.Object:
51 if (type == typeof(object))
52 {
53 return new ParameterExpression(name);
54 }
55 if (type == typeof(Exception))
56 {
58 }
59 if (type == typeof(object[]))
60 {
62 }
63 break;
64 case TypeCode.SByte:
66 case TypeCode.Single:
68 case TypeCode.String:
70 case TypeCode.UInt16:
72 case TypeCode.UInt32:
74 case TypeCode.UInt64:
76 }
77 }
78 return new TypedParameterExpression(type, name);
79 }
80
81 internal virtual bool GetIsByRef()
82 {
83 return false;
84 }
85
86 protected internal override Expression Accept(ExpressionVisitor visitor)
87 {
88 return visitor.VisitParameter(this);
89 }
90}
virtual Expression VisitParameter(ParameterExpression node)
override Expression Accept(ExpressionVisitor visitor)
static ParameterExpression Make(Type type, string name, bool isByRef)
TypeCode
Definition TypeCode.cs:4