Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SwitchExpression.cs
Go to the documentation of this file.
6
8
9[DebuggerTypeProxy(typeof(SwitchExpressionProxy))]
10public sealed class SwitchExpression : Expression
11{
12 public sealed override Type Type { get; }
13
14 public sealed override ExpressionType NodeType => ExpressionType.Switch;
15
16 public Expression SwitchValue { get; }
17
19
20 public Expression? DefaultBody { get; }
21
22 public MethodInfo? Comparison { get; }
23
24 internal bool IsLifted
25 {
26 get
27 {
28 if (SwitchValue.Type.IsNullableType())
29 {
30 if (!(Comparison == null))
31 {
32 return !TypeUtils.AreEquivalent(SwitchValue.Type, Comparison.GetParametersCached()[0].ParameterType.GetNonRefType());
33 }
34 return true;
35 }
36 return false;
37 }
38 }
39
48
49 protected internal override Expression Accept(ExpressionVisitor visitor)
50 {
51 return visitor.VisitSwitch(this);
52 }
53
62}
static bool AreEquivalent(Type t1, Type t2)
Definition TypeUtils.cs:664
static SwitchExpression Switch(Expression switchValue, params SwitchCase[]? cases)
SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection< SwitchCase > cases)
ReadOnlyCollection< SwitchCase > Cases
SwitchExpression Update(Expression switchValue, IEnumerable< SwitchCase >? cases, Expression? defaultBody)
override Expression Accept(ExpressionVisitor visitor)