Пример #1
0
 public CustomMethodInvoker(Type thisType, Type[] parameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     _action         = action;
     _options        = options;
     _thisType       = thisType;
     _parameterTypes = parameterTypes;
 }
Пример #2
0
 public SyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     _invoker        = invoker;
     _options        = options;
     _thisType       = thisType;
     _parameterTypes = parameterTypes;
 }
Пример #3
0
 public SyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     _invoker = invoker;
     _options = options;
     _thisType = thisType;
     _parameterTypes = parameterTypes;
 }
Пример #4
0
 private RuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     _syntheticMethodId     = syntheticMethodId;
     _declaringType         = declaringType;
     _options               = options;
     _action                = action;
     _runtimeParameterTypes = runtimeParameterTypes;
 }
 private RuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _declaringType = declaringType;
     _options = options;
     _invoker = invoker;
     _runtimeParameterTypes = runtimeParameterTypes;
 }
Пример #6
0
 private RuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     _syntheticMethodId     = syntheticMethodId;
     _declaringType         = declaringType;
     _options               = options;
     _invoker               = invoker;
     _runtimeParameterTypes = runtimeParameterTypes;
 }
Пример #7
0
 private RuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeType declaringType, RuntimeType[] runtimeParameterTypesAndReturn, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _name          = name;
     _declaringType = declaringType;
     _options       = options;
     _invoker       = invoker;
     _runtimeParameterTypesAndReturn = runtimeParameterTypesAndReturn;
 }
 private RuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeType declaringType, RuntimeType[] runtimeParameterTypesAndReturn, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _name = name;
     _declaringType = declaringType;
     _options = options;
     _invoker = invoker;
     _runtimeParameterTypesAndReturn = runtimeParameterTypesAndReturn;
 }
 private RuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] parameterTypes, RuntimeTypeInfo returnType, InvokerOptions options, CustomMethodInvokerAction action)
 {
     _syntheticMethodId = syntheticMethodId;
     _name                  = name;
     _declaringType         = declaringType;
     _options               = options;
     _action                = action;
     _runtimeParameterTypes = parameterTypes;
     _returnType            = returnType;
 }
Пример #10
0
 private RuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeTypeInfo declaringType, RuntimeTypeInfo[] parameterTypes, RuntimeTypeInfo returnType, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _name                  = name;
     _declaringType         = declaringType;
     _options               = options;
     _invoker               = invoker;
     _runtimeParameterTypes = parameterTypes;
     _returnType            = returnType;
 }
 private RuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeTypeInfo declaringType, RuntimeTypeInfo[] parameterTypes, RuntimeTypeInfo returnType, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _name = name;
     _declaringType = declaringType;
     _options = options;
     _invoker = invoker;
     _runtimeParameterTypes = parameterTypes;
     _returnType = returnType;
 }
        //
        // Certain types and methods are edge-cases that require special handling.
        //
        public static MethodInvoker GetCustomMethodInvokerIfNeeded(this MethodBase methodBase)
        {
            Type declaringType = methodBase.DeclaringType;
            bool isNullable    = declaringType.IsConstructedGenericType && declaringType.GetGenericTypeDefinition() == CommonRuntimeTypes.Nullable;

            Dictionary <MethodBase, CustomMethodInvokerAction> map;

            if (isNullable)
            {
                map = NullableActions.Map;
            }
            else if (declaringType == CommonRuntimeTypes.String)
            {
                map = StringActions.Map;
            }
            else
            {
                return(null);
            }

            if (!(map.TryGetValue(methodBase.MetadataDefinitionMethod, out CustomMethodInvokerAction action)))
            {
                return(null);
            }

            ParameterInfo[] parameterInfos = methodBase.GetParametersNoCopy();
            Type[]          parameterTypes = new Type[parameterInfos.Length];
            for (int i = 0; i < parameterInfos.Length; i++)
            {
                parameterTypes[i] = parameterInfos[i].ParameterType;
            }

            InvokerOptions options = (methodBase.IsStatic || methodBase is ConstructorInfo || isNullable) ? InvokerOptions.AllowNullThis : InvokerOptions.None;

            return(new CustomMethodInvoker(declaringType, parameterTypes, options, action));
        }
 public sealed override MethodInvoker GetSyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     return(new SyntheticMethodInvoker(thisType, parameterTypes, options, invoker));
 }
 public sealed override MethodInvoker GetSyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     return new SyntheticMethodInvoker(thisType, parameterTypes, options, invoker);
 }
 internal static RuntimeSyntheticConstructorInfo GetRuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     return(new RuntimeSyntheticConstructorInfo(syntheticMethodId, declaringType, runtimeParameterTypes, options, action));
 }
Пример #16
0
 //==============================================================================================
 // Other
 //==============================================================================================
 public abstract MethodInvoker GetSyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func <Object, Object[], Object> invoker);
Пример #17
0
 internal static RuntimeMethodInfo GetRuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeType declaringType, RuntimeType[] runtimeParameterTypesAndReturn, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     return(new RuntimeSyntheticMethodInfo(syntheticMethodId, name, declaringType, runtimeParameterTypesAndReturn, options, invoker).WithDebugName());
 }
Пример #18
0
 internal static RuntimeSyntheticConstructorInfo GetRuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeType declaringType, RuntimeType[] runtimeParameterTypesAndReturn, InvokerOptions options, Func <Object, Object[], Object> invoker)
 {
     return(new RuntimeSyntheticConstructorInfo(syntheticMethodId, declaringType, runtimeParameterTypesAndReturn, options, invoker));
 }
 internal static RuntimeMethodInfo GetRuntimeSyntheticMethodInfo(SyntheticMethodId syntheticMethodId, String name, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, RuntimeTypeInfo returnType, InvokerOptions options, CustomMethodInvokerAction action)
 {
     return(new RuntimeSyntheticMethodInfo(syntheticMethodId, name, declaringType, runtimeParameterTypes, returnType, options, action).WithDebugName());
 }
Пример #20
0
 //==============================================================================================
 // Other
 //==============================================================================================
 public abstract MethodInvoker GetSyntheticMethodInvoker(RuntimeTypeHandle thisType, RuntimeTypeHandle[] parameterTypes, InvokerOptions options, Func<Object, Object[], Object> invoker);