Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IteratorDescriptor.cs
Go to the documentation of this file.
5
7
8internal sealed class IteratorDescriptor
9{
11
13
14 private Label _lblNext;
15
16 private bool _hasNext;
17
19
21
23
25
27
28 public bool HasLabelNext => _hasNext;
29
31 {
32 get
33 {
34 return _locPos;
35 }
36 set
37 {
38 _locPos = value;
39 }
40 }
41
42 public bool IsBranching => _brctxt != BranchingContext.None;
43
45
47
49 {
50 get
51 {
52 return _storage;
53 }
54 set
55 {
57 }
58 }
59
61 {
62 Init(null, helper);
63 }
64
69
70 [MemberNotNull("_helper")]
72 {
73 _helper = helper;
75 }
76
78 {
79 return _lblNext;
80 }
81
88
90 {
91 if (iterInfo.HasLabelNext)
92 {
93 _lblNext = iterInfo.GetLabelNext();
94 _hasNext = true;
95 }
96 _storage = iterInfo.Storage;
97 }
98
100 {
101 if (_hasNext)
102 {
104 _hasNext = false;
105 }
107 }
108
109 public void CacheCount()
110 {
111 PushValue();
113 }
114
146
152
153 public void PushValue()
154 {
155 switch (_storage.Location)
156 {
157 case ItemLocation.Stack:
159 break;
160 case ItemLocation.Parameter:
162 break;
163 case ItemLocation.Local:
165 break;
166 case ItemLocation.Current:
167 {
170 _helper.Call(currentLocation.CurrentMethod);
171 break;
172 }
173 }
174 }
175
176 public void EnsureStack()
177 {
178 switch (_storage.Location)
179 {
180 case ItemLocation.Stack:
181 return;
182 case ItemLocation.Parameter:
183 case ItemLocation.Local:
184 case ItemLocation.Current:
185 PushValue();
186 break;
187 case ItemLocation.Global:
190 break;
191 }
193 }
194
195 public void EnsureNoStack(string locName)
196 {
197 if (_storage.Location == ItemLocation.Stack)
198 {
200 }
201 }
202
203 public void EnsureLocal(string locName)
204 {
205 if (_storage.Location != ItemLocation.Local)
206 {
207 if (_storage.IsCached)
208 {
210 }
211 else
212 {
214 }
215 }
216 }
217
219 {
221 {
222 EnsureStack();
225 }
226 }
227
228 public void DiscardStack()
229 {
230 if (_storage.Location == ItemLocation.Stack)
231 {
234 }
235 }
236
237 public void EnsureStackNoCache()
238 {
240 EnsureStack();
241 }
242
243 public void EnsureNoStackNoCache(string locName)
244 {
247 }
248
249 public void EnsureLocalNoCache(string locName)
250 {
253 }
254
256 {
259 }
260
262 {
264 {
265 if (!_storage.IsCached)
266 {
267 goto IL_0087;
268 }
270 {
271 EnsureStack();
273 }
274 else
275 {
277 {
278 goto IL_0087;
279 }
280 EnsureStack();
282 }
283 }
284 goto IL_014d;
285 IL_014d:
287 return;
288 IL_0087:
291 {
293 {
295 }
296 else
297 {
299 }
300 }
302 {
306 }
307 goto IL_014d;
308 }
309}
static readonly OpCode Castclass
Definition OpCodes.cs:235
static readonly OpCode Ldloca
Definition OpCodes.cs:427
static readonly OpCode Stloc
Definition OpCodes.cs:429
static readonly OpCode Add
Definition OpCodes.cs:179
static readonly OpCode Bge
Definition OpCodes.cs:123
static readonly OpCode Pop
Definition OpCodes.cs:79
static readonly OpCode Ldloc
Definition OpCodes.cs:425
static readonly OpCode Dup
Definition OpCodes.cs:77
void BranchAndMark(Label lblBranch, Label lblMark)
LocalBuilder DeclareLocal(string name, Type type)
void CallCacheItem(Type itemStorageType)
void CallCacheCount(Type itemStorageType)
void SetIterator(IteratorDescriptor iterInfo)
void EnsureItemStorageType(XmlQueryType xmlType, Type storageTypeDest)
IteratorDescriptor(IteratorDescriptor iterParent)
void SetBranching(BranchingContext brctxt, Label lblBranch)
void SetIterator(Label lblNext, StorageDescriptor storage)
void Init(IteratorDescriptor iterParent, GenerateHelper helper)
static readonly Dictionary< Type, XmlILStorageMethods > StorageMethods
static readonly MethodInfo ItemsToNavs
static readonly MethodInfo NavsToItems
StorageDescriptor ToStorageType(Type itemStorageType)
StorageDescriptor ToLocal(LocalBuilder loc)
static StorageDescriptor Stack(Type itemStorageType, bool isCached)