Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EmitCacheConstants()

void System.Linq.Expressions.Compiler.BoundConstants.EmitCacheConstants ( LambdaCompiler lc)
inlinepackage

Definition at line 82 of file BoundConstants.cs.

83 {
84 int num = 0;
86 {
87 if (ShouldCache(reference.Value))
88 {
89 num++;
90 }
91 }
92 if (num == 0)
93 {
94 return;
95 }
97 _cache.Clear();
99 {
100 if (ShouldCache(reference2.Value))
101 {
102 if (--num > 0)
103 {
104 lc.IL.Emit(OpCodes.Dup);
105 }
106 LocalBuilder localBuilder = lc.IL.DeclareLocal(reference2.Key.Type);
107 EmitConstantFromArray(lc, reference2.Key.Value, localBuilder.LocalType);
108 lc.IL.Emit(OpCodes.Stloc, localBuilder);
110 }
111 }
112 }
void Add(TKey key, TValue value)
void EmitConstantFromArray(LambdaCompiler lc, object value, Type type)
static void EmitConstantsArray(LambdaCompiler lc)
readonly Dictionary< TypedConstant, LocalBuilder > _cache
readonly Dictionary< TypedConstant, int > _references
static readonly OpCode Stloc
Definition OpCodes.cs:429
static readonly OpCode Dup
Definition OpCodes.cs:77

References System.Linq.Expressions.Compiler.BoundConstants._cache, System.Linq.Expressions.Compiler.BoundConstants._references, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Clear(), System.Reflection.Emit.OpCodes.Dup, System.Linq.Expressions.Compiler.BoundConstants.EmitConstantFromArray(), System.Linq.Expressions.Compiler.BoundConstants.EmitConstantsArray(), System.Linq.Expressions.Compiler.BoundConstants.ShouldCache(), and System.Reflection.Emit.OpCodes.Stloc.

Referenced by System.Linq.Expressions.Compiler.LambdaCompiler.InitializeMethod().