Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EnterTryFaultInstruction.cs
Go to the documentation of this file.
2
4{
6
7 public override string InstructionName => "EnterTryFault";
8
9 public override int ProducedContinuations => 1;
10
12
13 internal EnterTryFaultInstruction(int targetIndex)
14 : base(targetIndex)
15 {
16 }
17
18 internal void SetTryHandler(TryFaultHandler tryHandler)
19 {
20 _tryHandler = tryHandler;
21 }
22
23 public override int Run(InterpretedFrame frame)
24 {
26 int instructionIndex = frame.InstructionIndex;
27 frame.InstructionIndex++;
28 Instruction[] instructions = frame.Interpreter.Instructions.Instructions;
29 bool flag = false;
30 try
31 {
32 int num = frame.InstructionIndex;
33 while (num >= _tryHandler.TryStartIndex && num < _tryHandler.TryEndIndex)
34 {
35 num = (frame.InstructionIndex = num + instructions[num].Run(frame));
36 }
37 flag = true;
38 frame.RemoveContinuation();
39 frame.InstructionIndex += instructions[num].Run(frame);
40 }
41 finally
42 {
43 if (!flag)
44 {
45 int num2 = (frame.InstructionIndex = _tryHandler.FinallyStartIndex);
47 {
48 num2 = (frame.InstructionIndex = num2 + instructions[num2].Run(frame));
49 }
50 }
51 }
52 return frame.InstructionIndex - instructionIndex;
53 }
54}