Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ByRefNewInstruction.cs
Go to the documentation of this file.
3
5
6internal sealed class ByRefNewInstruction : NewInstruction
7{
8 private readonly ByRefUpdater[] _byrefArgs;
9
10 public override string InstructionName => "ByRefNew";
11
12 internal ByRefNewInstruction(ConstructorInfo target, int argumentCount, ByRefUpdater[] byrefArgs)
13 : base(target, argumentCount)
14 {
15 _byrefArgs = byrefArgs;
16 }
17
18 public sealed override int Run(InterpretedFrame frame)
19 {
20 int num = frame.StackIndex - _argumentCount;
21 object[] args = GetArgs(frame, num);
22 try
23 {
24 object obj;
25 try
26 {
27 obj = _constructor.Invoke(args);
28 }
30 {
33 }
34 frame.Data[num] = obj;
35 frame.StackIndex = num + 1;
36 }
37 finally
38 {
39 ByRefUpdater[] byrefArgs = _byrefArgs;
40 foreach (ByRefUpdater byRefUpdater in byrefArgs)
41 {
42 byRefUpdater.Update(frame, args[byRefUpdater.ArgumentIndex]);
43 }
44 }
45 return 1;
46 }
47}
ByRefNewInstruction(ConstructorInfo target, int argumentCount, ByRefUpdater[] byrefArgs)
void Update(InterpretedFrame frame, object value)
static void UnwrapAndRethrow(TargetInvocationException exception)
object[] GetArgs(InterpretedFrame frame, int first)
object Invoke(object?[]? parameters)