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

◆ Run()

override int System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run ( InterpretedFrame frame)
inline

Definition at line 32 of file MethodInfoCallInstruction.cs.

33 {
34 int num = frame.StackIndex - _argumentCount;
35 object obj;
36 if (_target.IsStatic)
37 {
38 object[] args = GetArgs(frame, num, 0);
39 try
40 {
41 obj = _target.Invoke(null, args);
42 }
44 {
45 ExceptionHelpers.UnwrapAndRethrow(exception);
47 }
48 }
49 else
50 {
51 object obj2 = frame.Data[num];
52 Instruction.NullCheck(obj2);
53 object[] args2 = GetArgs(frame, num, 1);
54 if (CallInstruction.TryGetLightLambdaTarget(obj2, out var lightLambda))
55 {
56 obj = InterpretLambdaInvoke(lightLambda, args2);
57 }
58 else
59 {
60 try
61 {
62 obj = _target.Invoke(obj2, args2);
63 }
64 catch (TargetInvocationException exception2)
65 {
66 ExceptionHelpers.UnwrapAndRethrow(exception2);
68 }
69 }
70 }
71 if (_target.ReturnType != typeof(void))
72 {
73 frame.Data[num] = obj;
74 frame.StackIndex = num + 1;
75 }
76 else
77 {
78 frame.StackIndex = num;
79 }
80 return 1;
81 }
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.MethodInfoCallInstruction._target, 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, and System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow().