Microsoft.Scripting.Interpreter.CallInstruction.TryGetParameterOrReturnType C# (CSharp) Method

TryGetParameterOrReturnType() private static method

Gets the next type or null if no more types are available.
private static TryGetParameterOrReturnType ( MethodInfo target, ParameterInfo pi, int index ) : Type
target System.Reflection.MethodInfo
pi System.Reflection.ParameterInfo
index int
return System.Type
        private static Type TryGetParameterOrReturnType(MethodInfo target, ParameterInfo[] pi, int index) {
            if (!target.IsStatic) {
                index--;
                if (index < 0) {
                    return target.DeclaringType;
                }
            }

            if (index < pi.Length) {
                // next in signature
                return pi[index].ParameterType;
            }

            if (target.ReturnType == typeof(void) || index > pi.Length) {
                // no more parameters
                return null;
            }

            // last parameter on Invoke is return type
            return target.ReturnType;
        }