Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ConditionalExpression.cs
Go to the documentation of this file.
2
4
5[DebuggerTypeProxy(typeof(ConditionalExpressionProxy))]
7{
8 public sealed override ExpressionType NodeType => ExpressionType.Conditional;
9
10 public override Type Type => IfTrue.Type;
11
12 public Expression Test { get; }
13
14 public Expression IfTrue { get; }
15
17
19 {
20 Test = test;
21 IfTrue = ifTrue;
22 }
23
24 internal static ConditionalExpression Make(Expression test, Expression ifTrue, Expression ifFalse, Type type)
25 {
26 if (ifTrue.Type != type || ifFalse.Type != type)
27 {
28 return new FullConditionalExpressionWithType(test, ifTrue, ifFalse, type);
29 }
30 if (ifFalse is DefaultExpression && ifFalse.Type == typeof(void))
31 {
32 return new ConditionalExpression(test, ifTrue);
33 }
34 return new FullConditionalExpression(test, ifTrue, ifFalse);
35 }
36
37 internal virtual Expression GetFalse()
38 {
39 return Utils.Empty;
40 }
41
42 protected internal override Expression Accept(ExpressionVisitor visitor)
43 {
44 return visitor.VisitConditional(this);
45 }
46
48 {
49 if (test == Test && ifTrue == IfTrue && ifFalse == IfFalse)
50 {
51 return this;
52 }
53 return Expression.Condition(test, ifTrue, ifFalse, Type);
54 }
55}
static ConditionalExpression Make(Expression test, Expression ifTrue, Expression ifFalse, Type type)
ConditionalExpression(Expression test, Expression ifTrue)
override Expression Accept(ExpressionVisitor visitor)
ConditionalExpression Update(Expression test, Expression ifTrue, Expression ifFalse)
virtual Expression VisitConditional(ConditionalExpression node)
static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
static readonly DefaultExpression Empty
Definition Utils.cs:60