Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SwitchExpression.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
using
System.Collections.ObjectModel
;
3
using
System.Diagnostics
;
4
using
System.Dynamic.Utils
;
5
using
System.Reflection
;
6
7
namespace
System.Linq.Expressions
;
8
9
[
DebuggerTypeProxy
(
typeof
(SwitchExpressionProxy))]
10
public
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
18
public
ReadOnlyCollection<SwitchCase>
Cases
{
get
; }
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
40
internal
SwitchExpression
(
Type
type
,
Expression
switchValue
,
Expression
defaultBody
,
MethodInfo
comparison
,
ReadOnlyCollection<SwitchCase>
cases
)
41
{
42
Type
=
type
;
43
SwitchValue
=
switchValue
;
44
DefaultBody
=
defaultBody
;
45
Comparison
=
comparison
;
46
Cases
=
cases
;
47
}
48
49
protected
internal
override
Expression
Accept
(
ExpressionVisitor
visitor
)
50
{
51
return
visitor
.VisitSwitch(
this
);
52
}
53
54
public
SwitchExpression
Update
(
Expression
switchValue
,
IEnumerable<SwitchCase>
?
cases
,
Expression
?
defaultBody
)
55
{
56
if
(
switchValue
==
SwitchValue
&&
defaultBody
==
DefaultBody
&&
cases
!=
null
&&
ExpressionUtils
.SameElements(
ref
cases
,
Cases
))
57
{
58
return
this
;
59
}
60
return
Expression
.
Switch
(
Type
,
switchValue
,
defaultBody
,
Comparison
,
cases
);
61
}
62
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Dynamic.Utils.ExpressionUtils
Definition
ExpressionUtils.cs:11
System.Dynamic.Utils.TypeUtils.AreEquivalent
static bool AreEquivalent(Type t1, Type t2)
Definition
TypeUtils.cs:664
System.Dynamic.Utils.TypeUtils
Definition
TypeUtils.cs:9
System.Linq.Expressions.ExpressionVisitor
Definition
ExpressionVisitor.cs:9
System.Linq.Expressions.Expression.Switch
static SwitchExpression Switch(Expression switchValue, params SwitchCase[]? cases)
Definition
Expression.cs:4727
System.Linq.Expressions.Expression.Type
virtual Type Type
Definition
Expression.cs:683
System.Linq.Expressions.Expression
Definition
Expression.cs:5484
System.Linq.Expressions.SwitchExpression.SwitchExpression
SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection< SwitchCase > cases)
Definition
SwitchExpression.cs:40
System.Linq.Expressions.SwitchExpression.Comparison
MethodInfo? Comparison
Definition
SwitchExpression.cs:22
System.Linq.Expressions.SwitchExpression.SwitchValue
Expression SwitchValue
Definition
SwitchExpression.cs:16
System.Linq.Expressions.SwitchExpression.DefaultBody
Expression? DefaultBody
Definition
SwitchExpression.cs:20
System.Linq.Expressions.SwitchExpression.Cases
ReadOnlyCollection< SwitchCase > Cases
Definition
SwitchExpression.cs:18
System.Linq.Expressions.SwitchExpression.IsLifted
bool IsLifted
Definition
SwitchExpression.cs:25
System.Linq.Expressions.SwitchExpression.Update
SwitchExpression Update(Expression switchValue, IEnumerable< SwitchCase >? cases, Expression? defaultBody)
Definition
SwitchExpression.cs:54
System.Linq.Expressions.SwitchExpression.Accept
override Expression Accept(ExpressionVisitor visitor)
Definition
SwitchExpression.cs:49
System.Linq.Expressions.SwitchExpression.NodeType
override ExpressionType NodeType
Definition
SwitchExpression.cs:14
System.Linq.Expressions.SwitchExpression
Definition
SwitchExpression.cs:11
System.Reflection.MethodInfo
Definition
MethodInfo.cs:7
System.Type
Definition
Type.cs:14
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Collections.ObjectModel
Definition
EventArgsCache.cs:4
System.Diagnostics
Definition
AggregationManager.cs:6
System.Dynamic.Utils
Definition
CacheDict.cs:4
System.Linq.Expressions.ExpressionType
ExpressionType
Definition
ExpressionType.cs:4
System.Linq.Expressions
Definition
AnalyzedTree.cs:3
System.Reflection
Definition
ICustomTypeProvider.cs:1
System.ExceptionArgument.comparison
@ comparison
System.ExceptionArgument.type
@ type
source
System.Linq.Expressions
System.Linq.Expressions
SwitchExpression.cs
Generated by
1.10.0