Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LocalVariables.cs
Go to the documentation of this file.
3
5
6internal sealed class LocalVariables
7{
8 private sealed class VariableScope
9 {
10 public readonly int Start;
11
12 public int Stop = int.MaxValue;
13
14 public readonly LocalVariable Variable;
15
16 public readonly VariableScope Parent;
17
19
21 {
23 Start = start;
24 Parent = parent;
25 }
26 }
27
29
31
32 private int _localCount;
33
34 private int _maxLocalCount;
35
37
39
61
63 {
65 variableScope.Stop = end;
66 if (variableScope.Parent != null)
67 {
68 _variables[definition.Parameter] = variableScope.Parent;
69 }
70 else
71 {
72 _variables.Remove(definition.Parameter);
73 }
75 }
76
78 {
81 _variables[variable].Variable.IsBoxed = true;
82 int num = 0;
83 for (int i = variableScope.Start; i < variableScope.Stop && i < instructions.Count; i++)
84 {
85 if (variableScope.ChildScopes != null && variableScope.ChildScopes[num].Start == i)
86 {
88 i = variableScope2.Stop;
89 num++;
90 }
91 else
92 {
93 instructions.SwitchToBoxed(variable2.Index, i);
94 }
95 }
96 }
97
99 {
101 {
102 local = value.Variable;
103 return true;
104 }
106 {
107 return true;
108 }
109 local = null;
110 return false;
111 }
112
123}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
VariableScope(LocalVariable variable, int start, VariableScope parent)
Dictionary< ParameterExpression, LocalVariable > ClosureVariables
void Box(ParameterExpression variable, InstructionList instructions)
bool TryGetLocalOrClosure(ParameterExpression var, [NotNullWhen(true)] out LocalVariable local)
readonly HybridReferenceDictionary< ParameterExpression, VariableScope > _variables
LocalVariable AddClosureVariable(ParameterExpression variable)
Dictionary< ParameterExpression, LocalVariable > _closureVariables
void UndefineLocal(LocalDefinition definition, int end)
LocalDefinition DefineLocal(ParameterExpression variable, int start)
static byte Max(byte val1, byte val2)
Definition Math.cs:738