Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LeaveExceptionHandlerInstruction.cs
Go to the documentation of this file.
2
4{
6
7 private readonly bool _hasValue;
8
9 public override string InstructionName => "LeaveExceptionHandler";
10
11 public override int ConsumedStack
12 {
13 get
14 {
15 if (!_hasValue)
16 {
17 return 0;
18 }
19 return 1;
20 }
21 }
22
23 public override int ProducedStack
24 {
25 get
26 {
27 if (!_hasValue)
28 {
29 return 0;
30 }
31 return 1;
32 }
33 }
34
35 private LeaveExceptionHandlerInstruction(int labelIndex, bool hasValue)
36 : base(labelIndex)
37 {
38 _hasValue = hasValue;
39 }
40
41 internal static LeaveExceptionHandlerInstruction Create(int labelIndex, bool hasValue)
42 {
43 if (labelIndex < 32)
44 {
45 int num = (2 * labelIndex) | (hasValue ? 1 : 0);
46 return s_cache[num] ?? (s_cache[num] = new LeaveExceptionHandlerInstruction(labelIndex, hasValue));
47 }
48 return new LeaveExceptionHandlerInstruction(labelIndex, hasValue);
49 }
50
51 public override int Run(InterpretedFrame frame)
52 {
53 return GetLabel(frame).Index - frame.InstructionIndex;
54 }
55}
static LeaveExceptionHandlerInstruction Create(int labelIndex, bool hasValue)