Beispiel #1
0
 public CustomMethodInvoker(Type thisType, Type[] parameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     _action         = action;
     _options        = options;
     _thisType       = thisType;
     _parameterTypes = parameterTypes;
 }
Beispiel #2
0
 private RuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     _syntheticMethodId     = syntheticMethodId;
     _declaringType         = declaringType;
     _options               = options;
     _action                = action;
     _runtimeParameterTypes = runtimeParameterTypes;
 }
 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;
 }
 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());
 }
 internal static RuntimeSyntheticConstructorInfo GetRuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeArrayTypeInfo declaringType, RuntimeTypeInfo[] runtimeParameterTypes, InvokerOptions options, CustomMethodInvokerAction action)
 {
     return(new RuntimeSyntheticConstructorInfo(syntheticMethodId, declaringType, runtimeParameterTypes, options, action));
 }
        private static void AddMethod(this Dictionary <MethodBase, CustomMethodInvokerAction> map, Type declaringType, string name, Type[] parameterTypes, CustomMethodInvokerAction action)
        {
            const BindingFlags bf = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding;

            MethodBase methodBase;

            if (name == ConstructorInfo.ConstructorName)
            {
                methodBase = declaringType.GetConstructor(bf, null, parameterTypes, null);
            }
            else
            {
                methodBase = declaringType.GetMethod(name, 0, bf, null, parameterTypes, null);
            }

            if (methodBase == null)
            {
                return; // If we got here, this specific member was not included in the metadata.
            }
            Debug.Assert(methodBase == methodBase.MetadataDefinitionMethod);
            map.Add(methodBase, action);
        }
 private static void AddConstructor(this Dictionary <MethodBase, CustomMethodInvokerAction> map, Type declaringType, Type[] parameterTypes, CustomMethodInvokerAction action)
 {
     map.AddMethod(declaringType, ConstructorInfo.ConstructorName, parameterTypes, action);
 }