Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
LambdaExpression.cs
Go to the documentation of this file.
9
11
12[DebuggerTypeProxy(typeof(LambdaExpressionProxy))]
14{
15 private static readonly MethodInfo s_expressionCompileMethodInfo = typeof(Expression<>).GetMethod("Compile", System.Type.EmptyTypes);
16
17 private readonly Expression _body;
18
19 public sealed override Type Type => TypeCore;
20
21 internal abstract Type TypeCore { get; }
22
23 internal abstract Type PublicType { get; }
24
25 public sealed override ExpressionType NodeType => ExpressionType.Lambda;
26
28
29 public string? Name => NameCore;
30
31 internal virtual string? NameCore => null;
32
34
35 public Type ReturnType => Type.GetInvokeMethod().ReturnType;
36
37 public bool TailCall => TailCallCore;
38
39 internal virtual bool TailCallCore => false;
40
41 [ExcludeFromCodeCoverage(Justification = "Unreachable")]
42 int IParameterProvider.ParameterCount => ParameterCount;
43
44 [ExcludeFromCodeCoverage(Justification = "Unreachable")]
45 internal virtual int ParameterCount
46 {
47 get
48 {
50 }
51 }
52
54 {
55 _body = body;
56 }
57
58 [ExcludeFromCodeCoverage(Justification = "Unreachable")]
63
64 [ExcludeFromCodeCoverage(Justification = "Unreachable")]
69
70 [ExcludeFromCodeCoverage(Justification = "Unreachable")]
72 {
74 }
75
76 internal static MethodInfo GetCompileMethod(Type lambdaExpressionType)
77 {
78 if (lambdaExpressionType == typeof(LambdaExpression))
79 {
80 return typeof(LambdaExpression).GetMethod("Compile", System.Type.EmptyTypes);
81 }
83 }
84
86 {
87 return LambdaCompiler.Compile(this);
88 }
89
90 public Delegate Compile(bool preferInterpretation)
91 {
92 if (preferInterpretation)
93 {
94 return new LightCompiler().CompileTop(this).CreateDelegate();
95 }
96 return Compile();
97 }
98
99 internal abstract LambdaExpression Accept(StackSpiller spiller);
100
101 public Delegate Compile(DebugInfoGenerator debugInfoGenerator)
102 {
103 return Compile();
104 }
105}
static Delegate Compile(LambdaExpression lambda)
LightDelegateCreator CompileTop(LambdaExpression node)
static readonly MethodInfo s_expressionCompileMethodInfo
LambdaExpression Accept(StackSpiller spiller)
ParameterExpression IParameterProvider. GetParameter(int index)
ReadOnlyCollection< ParameterExpression > Parameters
virtual ParameterExpression GetParameter(int index)
Delegate Compile(bool preferInterpretation)
virtual ReadOnlyCollection< ParameterExpression > GetOrMakeParameters()
static MethodInfo GetCompileMethod(Type lambdaExpressionType)
Delegate Compile(DebugInfoGenerator debugInfoGenerator)
virtual MemberInfo GetMemberWithSameMetadataDefinitionAs(MemberInfo member)
Definition Type.cs:649
static readonly Type[] EmptyTypes
Definition Type.cs:19
ParameterExpression GetParameter(int index)