Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Run()

override int System.Linq.Expressions.Interpreter.ByRefMethodInfoCallInstruction.Run ( InterpretedFrame frame)
inlinesealed

Definition at line 28 of file ByRefMethodInfoCallInstruction.cs.

29 {
30 int num = frame.StackIndex - _argumentCount;
31 object[] array = null;
32 object obj = null;
33 try
34 {
35 object obj2;
36 if (_target.IsStatic)
37 {
38 array = GetArgs(frame, num, 0);
39 try
40 {
41 obj2 = _target.Invoke(null, array);
42 }
44 {
45 ExceptionHelpers.UnwrapAndRethrow(exception);
47 }
48 }
49 else
50 {
51 obj = frame.Data[num];
52 Instruction.NullCheck(obj);
53 array = GetArgs(frame, num, 1);
54 if (CallInstruction.TryGetLightLambdaTarget(obj, out var lightLambda))
55 {
56 obj2 = InterpretLambdaInvoke(lightLambda, array);
57 }
58 else
59 {
60 try
61 {
62 obj2 = _target.Invoke(obj, array);
63 }
64 catch (TargetInvocationException exception2)
65 {
66 ExceptionHelpers.UnwrapAndRethrow(exception2);
68 }
69 }
70 }
71 if (_target.ReturnType != typeof(void))
72 {
73 frame.Data[num] = obj2;
74 frame.StackIndex = num + 1;
75 }
76 else
77 {
78 frame.StackIndex = num;
79 }
80 }
81 finally
82 {
83 if (array != null)
84 {
85 ByRefUpdater[] byrefArgs = _byrefArgs;
86 foreach (ByRefUpdater byRefUpdater in byrefArgs)
87 {
88 byRefUpdater.Update(frame, (byRefUpdater.ArgumentIndex == -1) ? obj : array[byRefUpdater.ArgumentIndex]);
89 }
90 }
91 }
92 return 1;
93 }
void Update(InterpretedFrame frame, object value)
object InterpretLambdaInvoke(LightLambda targetLambda, object[] args)
object[] GetArgs(InterpretedFrame frame, int first, int skip)
object? Invoke(object? obj, object?[]? parameters)

References System.Linq.Expressions.Interpreter.MethodInfoCallInstruction._argumentCount, System.Linq.Expressions.Interpreter.ByRefMethodInfoCallInstruction._byrefArgs, System.Linq.Expressions.Interpreter.MethodInfoCallInstruction._target, System.Linq.Expressions.Interpreter.ByRefUpdater.ArgumentIndex, System.array, System.Linq.Expressions.Interpreter.InterpretedFrame.Data, System.exception, System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.GetArgs(), System.Linq.Expressions.Interpreter.CallInstruction.InterpretLambdaInvoke(), System.Reflection.MethodBase.Invoke(), System.Reflection.MethodBase.IsStatic, System.Linq.Expressions.Interpreter.Instruction.NullCheck(), System.obj, System.Reflection.MethodInfo.ReturnType, System.Linq.Expressions.Interpreter.CallInstruction.TryGetLightLambdaTarget(), System.Dynamic.Utils.ContractUtils.Unreachable, System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow(), and System.Linq.Expressions.Interpreter.ByRefUpdater.Update().