Example #1
0
#pragma warning restore 649		

		internal MonoArrayMethod (Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
			name = methodName;
			parent = arrayClass;
			ret = returnType;
			parameters = (Type[])parameterTypes.Clone();
			call_conv = callingConvention;
		}
Example #2
0
 public void DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
 {
     bool defaultReturnTypeAndParameters = returnType == null && parameterTypes == null;
     if (callingConvention == CallingConventions.Standard)
     {
         if (defaultReturnTypeAndParameters)
         {
             // Use DefineMethod(string, MethodAttributes)
             TypeBuilder type1 = Helpers.DynamicType(TypeAttributes.Public);
             MethodBuilder method1 = type1.DefineMethod(name, attributes);
             VerifyMethod(type1, method1, name, attributes, callingConvention, returnType, parameterTypes);
         }
         // Use DefineMethod(string, MethodAttributes, Type, Type[])
         TypeBuilder type2 = Helpers.DynamicType(TypeAttributes.Public);
         MethodBuilder method2 = type2.DefineMethod(name, attributes, returnType, parameterTypes);
         VerifyMethod(type2, method2, name, attributes, callingConvention, returnType, parameterTypes);
     }
     if (defaultReturnTypeAndParameters)
     {
         // Use DefineMethod(string, MethodAttributes, CallingConventions)
         TypeBuilder type3 = Helpers.DynamicType(TypeAttributes.Public);
         MethodBuilder method3 = type3.DefineMethod(name, attributes, callingConvention);
         VerifyMethod(type3, method3, name, attributes, callingConvention, returnType, parameterTypes);
     }
     // Use DefineMethod(string, MethodAttributes, CallingConventions, Type, Type[])
     TypeBuilder type4 = Helpers.DynamicType(TypeAttributes.Public);
     MethodBuilder method4 = type4.DefineMethod(name, attributes, callingConvention, returnType, parameterTypes);
     VerifyMethod(type4, method4, name, attributes, callingConvention, returnType, parameterTypes);
 }
        /// <summary>
        /// Defines a constructor.
        /// </summary>
        /// <param name="typeBuilder">The type builder.</param>
        /// <param name="methodAttributes">The method attributes.</param>
        /// <param name="callingConvention">The calling convention.</param>
        /// <param name="parameterTypes">The parameter types.</param>
        /// <param name="parameterNames">The parameter names.</param>
        /// <returns>The constructor builder.</returns>
        public static ConstructorBuilder DefineConstructor(this TypeBuilder typeBuilder,
                                                           MethodAttributes methodAttributes,
                                                           CallingConventions callingConvention,
                                                           Type[] parameterTypes,
                                                           string[] parameterNames)
        {
            if (typeBuilder == null)
                throw new ArgumentNullException("typeBuilder");

            if (parameterTypes == null)
                throw new ArgumentNullException("parameterTypes");

            if (parameterNames == null)
                throw new ArgumentNullException("parameterNames");

            if (parameterTypes.Length != parameterNames.Length)
                throw new ArgumentException(Resources.NumberOfParameterTypesAndNamesMustBeEqual);

            // Define constructor.
            var constructorBuilder = typeBuilder.DefineConstructor(
                methodAttributes,
                callingConvention,
                parameterTypes);

            // Define constructor parameters.
            constructorBuilder.DefineParameters(parameterNames);

            return constructorBuilder;
        }
 internal static string ConstructParameters(Type[] parameters, CallingConventions callingConvention)
 {
     StringBuilder builder = new StringBuilder();
     string str = "";
     for (int i = 0; i < parameters.Length; i++)
     {
         Type type = parameters[i];
         builder.Append(str);
         string str2 = type.SigToString();
         if (type.IsByRef)
         {
             builder.Append(str2.TrimEnd(new char[] { '&' }));
             builder.Append(" ByRef");
         }
         else
         {
             builder.Append(str2);
         }
         str = ", ";
     }
     if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
     {
         builder.Append(str);
         builder.Append("...");
     }
     return builder.ToString();
 }
Example #5
0
        internal static SignatureHelper GetMethodSigHelper(
            Module scope, CallingConventions callingConvention, int cGenericParam,
            Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers,
            Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
        {
            SignatureHelper sigHelp;
            MdSigCallingConvention intCall;
                
            if (returnType == null)
            {
                returnType = typeof(void);
            }            

            intCall = MdSigCallingConvention.Default;

            if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
                intCall = MdSigCallingConvention.Vararg;

            if (cGenericParam > 0)
            {
                intCall |= MdSigCallingConvention.Generic;
            }

            if ((callingConvention & CallingConventions.HasThis) == CallingConventions.HasThis)
                intCall |= MdSigCallingConvention.HasThis;

            sigHelp = new SignatureHelper(scope, intCall, cGenericParam, returnType, 
                                            requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);            
            sigHelp.AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);

            return sigHelp;
        }
Example #6
0
        internal SymbolMethod(ModuleBuilder mod, MethodToken token, Type arrayClass, String methodName, 
            CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
        {
            // This is a kind of MethodInfo to represent methods for array type of unbaked type

            // Another way to look at this class is as a glorified MethodToken wrapper. At the time of this comment
            // this class is only constructed inside ModuleBuilder.GetArrayMethod and the only interesting thing 
            // passed into it is this MethodToken. The MethodToken was forged using a TypeSpec for an Array type and
            // the name of the method on Array. 
            // As none of the methods on Array have CustomModifiers their is no need to pass those around in here.
            m_mdMethod = token;

            // The ParameterTypes are also a bit interesting in that they may be unbaked TypeBuilders.
            m_returnType = returnType;
            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, 0, m_parameterTypes, 0, parameterTypes.Length);
            }
            else
            {
                m_parameterTypes = EmptyArray<Type>.Value; 
            }
   
            m_module = mod;
            m_containingType = arrayClass;
            m_name = methodName;
            m_callingConvention = callingConvention;

            m_signature = SignatureHelper.GetMethodSigHelper(
                mod, callingConvention, returnType, null, null, parameterTypes, null, null);
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="typeBuilder">Type builder</param>
 /// <param name="attributes">Attributes for the constructor (public, private, etc.)</param>
 /// <param name="parameters">Parameter types for the constructor</param>
 /// <param name="callingConventions">Calling convention for the constructor</param>
 public ConstructorBuilder(TypeBuilder typeBuilder, MethodAttributes attributes,
                           IEnumerable<Type> parameters, CallingConventions callingConventions)
 {
     if (typeBuilder == null)
         throw new ArgumentNullException("typeBuilder");
     Type = typeBuilder;
     Attributes = attributes;
     Parameters = new List<ParameterBuilder>();
     Parameters.Add(new ParameterBuilder(null, 0));
     if (parameters != null)
     {
         int x = 1;
         foreach (var parameterType in parameters)
         {
             Parameters.Add(new ParameterBuilder(parameterType, x));
             ++x;
         }
     }
     CallingConventions = callingConventions;
     Builder = Type.Builder.DefineConstructor(attributes, callingConventions,
                                              (parameters != null && parameters.Count() > 0)
                                                  ? parameters.ToArray()
                                                  : System.Type.EmptyTypes);
     Generator = Builder.GetILGenerator();
 }
        public void GetArrayMethod_MultiDimensionalArray(CallingConventions callingConvention)
        {
            ModuleBuilder module = Helpers.DynamicModule();
            VerifyGetArrayMethod(module, typeof(ModuleBuilderGetArrayMethod[,]), callingConvention.ToString() + "1", callingConvention, typeof(int), new Type[] { typeof(object) });

            VerifyGetArrayMethod(module, typeof(ModuleBuilderGetArrayMethod[,]), callingConvention.ToString() + "2", callingConvention, typeof(int), new Type[] { typeof(object), typeof(int), typeof(ModuleBuilderGetArrayMethod) });
        }
Example #9
0
#pragma warning restore 169, 414

		internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt)
		{
			this.name = name;
			this.attrs = attributes;
			this.call_conv = callingConvention;
			this.rtype = returnType;
			this.returnModReq = returnModReq;
			this.returnModOpt = returnModOpt;
			this.paramModReq = paramModReq;
			this.paramModOpt = paramModOpt;
			// The MSDN docs does not specify this, but the MS MethodBuilder
			// appends a HasThis flag if the method is not static
			if ((attributes & MethodAttributes.Static) == 0)
 				this.call_conv |= CallingConventions.HasThis;
			if (parameterTypes != null) {
				for (int i = 0; i < parameterTypes.Length; ++i)
					if (parameterTypes [i] == null)
						throw new ArgumentException ("Elements of the parameterTypes array cannot be null", "parameterTypes");

				this.parameters = new Type [parameterTypes.Length];
				System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
			}
			type = tb;
			table_idx = get_next_table_index (this, 0x06, true);

			((ModuleBuilder)tb.Module).RegisterToken (this, GetToken ().Token);
		}
        public void DefineConstructor(MethodAttributes methodAttributes, Type[] parameterTypes, CallingConventions callingConvention, BindingFlags bindingFlags)
        {
            TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public);

            FieldBuilder fieldBuilderA = type.DefineField("TestField", typeof(int), FieldAttributes.Private);
            FieldBuilder fieldBuilderB = type.DefineField("TestField", typeof(int), FieldAttributes.Private);

            ConstructorBuilder ctorBuilder = type.DefineConstructor(methodAttributes, callingConvention, parameterTypes);
            ILGenerator ctorIlGenerator = ctorBuilder.GetILGenerator();

            if (parameterTypes.Length != 0)
            {
                //Calling base class constructor
                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Call, typeof(object).GetConstructor(new Type[0]));

                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Ldarg_1);
                ctorIlGenerator.Emit(OpCodes.Stfld, fieldBuilderA);

                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Ldarg_2);
                ctorIlGenerator.Emit(OpCodes.Stfld, fieldBuilderB);
            }

            ctorIlGenerator.Emit(OpCodes.Ret);

            Type createdType = type.CreateTypeInfo().AsType();
            Assert.NotNull(createdType.GetConstructors(bindingFlags).FirstOrDefault());
        }
Example #11
0
        /// <summary>	
        /// 	타입의 생성자를 생성합니다. 
        /// </summary>
        /// <param name="methodAttributes">	생성자 메서드인 .ctor 의 메서드 특성입니다. </param>
        /// <param name="callingConventions">	메서드의 유효한 호출 규칙입니다. </param>
        /// <param name="parameterCriteriaMetadataInfos">	매개 변수의 표준적인 메타데이터 정보입니다. </param>
        /// <returns>	
        /// 	생성자를 생성할 때 사용하는 <see cref="ConstructorBuilder"/> 객체를 반환합니다. 
        /// </returns>
        public ConstructorBuilder CreateConstructor(MethodAttributes methodAttributes, CallingConventions callingConventions, IEnumerable<ParameterCriteriaMetadataInfo> parameterCriteriaMetadataInfos)
        {
            if (isStaticMethod(methodAttributes))
            {
                methodAttributes = MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName | MethodAttributes.Private | MethodAttributes.HideBySig;
                callingConventions = CallingConventions.Standard;
            }
            else
            {
                callingConventions = CallingConventions.HasThis;
            }

            var constructorBuilder = this.TypeBuilder.DefineConstructor(methodAttributes, callingConventions, parameterCriteriaMetadataInfos.Select( o => o.Type).ToArray());

            int iSeqence = 0;
            foreach (var parameter in parameterCriteriaMetadataInfos)
            {
                iSeqence++;
                constructorBuilder.DefineParameter(iSeqence, parameter.ParameterAttribute, parameter.Name);
            }

            var il = constructorBuilder.GetILGenerator();

            if (isStaticMethod(methodAttributes))	// 정적 생성자는 Object 개체 파생이 아니므로 Object 생성을 하지 않음
            {
                il.Emit(OpCodes.Nop);
            }
            else
            {
                il.Emit(OpCodes.Ldarg_0);
                il.Emit(OpCodes.Call, this.TypeBuilder.BaseType.GetConstructors()[0]);
            }

            return constructorBuilder;
        }
 public ConstructorBuilder DefineConstructor(MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes)
 {
     var cb = _typeBuilder.DefineConstructor(attributes, callingConvention, parameterTypes);
     _members.Add(cb);
     _paramsByMember.Add(cb, parameterTypes);
     return cb;
 }
        protected sealed override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
        {
            Debug.Assert(name != null);

            // GetMethodImpl() is a funnel for two groups of api. We can distinguish by comparing "types" to null.
            if (types == null)
            {
                // Group #1: This group of api accept only a name and BindingFlags. The other parameters are hard-wired by the non-virtual api entrypoints. 
                Debug.Assert(binder == null);
                Debug.Assert(callConvention == CallingConventions.Any);
                Debug.Assert(modifiers == null);
                return LowLevelTypeExtensions.GetMethod(this, name, bindingAttr);
            }
            else
            {
                if (!OnlySearchRelatedBitsSet(bindingAttr))  // We don't yet have proper handling for BindingFlags not related to search so throw rather return a wrong result.
                    throw new NotImplementedException();

                // Group #2: This group of api takes a set of parameter types and an optional binder. 
                if (callConvention != CallingConventions.Any)
                    throw new NotImplementedException();
                if (binder == null)
                    binder = Type.DefaultBinder;
                MethodInfo[] candidates = LowLevelTypeExtensions.GetMethods(this, name, bindingAttr);
                return (MethodInfo)binder.SelectMethod(bindingAttr, candidates, types, modifiers);
            }
        }
Example #14
0
		internal static void FormatParameters (StringBuilder sb, ParameterInfo[] p, CallingConventions callingConvention, bool serialization)
		{
			for (int i = 0; i < p.Length; ++i) {
				if (i > 0)
					sb.Append (", ");

				Type t = p[i].ParameterType;

				string typeName = t.FormatTypeName (serialization);

				// Legacy: Why use "ByRef" for by ref parameters? What language is this?
				// VB uses "ByRef" but it should precede (not follow) the parameter name.
				// Why don't we just use "&"?
				if (t.IsByRef && !serialization) {
					sb.Append (typeName.TrimEnd (new char[] { '&' }));
					sb.Append (" ByRef");
				} else {
					sb.Append (typeName);
				}
			}

			if ((callingConvention & CallingConventions.VarArgs) != 0) {
				if (p.Length > 0)
					sb.Append (", ");
				sb.Append ("...");
			}
		}
Example #15
0
        //***********************************************
        //
        // Constructor
        // 
        //***********************************************
        internal SymbolMethod(
            ModuleBuilder mod,
            MethodToken token,
            Type        arrayClass, 
            String      methodName, 
            CallingConventions callingConvention,
            Type        returnType,
            Type[]      parameterTypes)

        {
            m_module = mod;
            m_containingType = arrayClass;
            m_name = methodName;
            m_callingConvention = callingConvention;
            m_returnType = returnType;
            m_mdMethod = token;
            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
            }
            else
                m_parameterTypes = null;    
            m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, returnType, parameterTypes);
        }
Example #16
0
		private PropertySignature(CallingConventions callingConvention, Type propertyType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
		{
			this.callingConvention = callingConvention;
			this.propertyType = propertyType;
			this.parameterTypes = parameterTypes;
			this.customModifiers = customModifiers;
		}
        public void GetArrayMethod_ValidArrayValues_ReferenceParameterType(CallingConventions callingConvention)
        {
            ModuleBuilder module = Helpers.DynamicModule();
            VerifyGetArrayMethod(module, typeof(ModuleBuilderGetArrayMethod[]), callingConvention.ToString() + "1", callingConvention, typeof(int), new Type[] { typeof(object) });

            VerifyGetArrayMethod(module, typeof(ModuleBuilderGetArrayMethod[]), callingConvention.ToString() + "2", callingConvention, typeof(int), new Type[] { typeof(object), typeof(string), typeof(ModuleBuilderGetArrayMethod) });
        }
        public void DefineConstructor(MethodAttributes attributes, Type[] parameterTypes, CallingConventions callingConvention)
        {
            TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public);

            FieldBuilder fieldBuilderA = type.DefineField("TestField", typeof(int), FieldAttributes.Private);
            FieldBuilder fieldBuilderB = type.DefineField("TestField", typeof(int), FieldAttributes.Private);

            ConstructorBuilder constructor = type.DefineConstructor(attributes, callingConvention, parameterTypes);
            ILGenerator ctorIlGenerator = constructor.GetILGenerator();
            if (parameterTypes.Length != 0)
            {
                // Calling base class constructor
                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Call, typeof(object).GetConstructor(new Type[0]));

                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Ldarg_1);
                ctorIlGenerator.Emit(OpCodes.Stfld, fieldBuilderA);

                ctorIlGenerator.Emit(OpCodes.Ldarg_0);
                ctorIlGenerator.Emit(OpCodes.Ldarg_2);
                ctorIlGenerator.Emit(OpCodes.Stfld, fieldBuilderB);
            }
            ctorIlGenerator.Emit(OpCodes.Ret);
            Helpers.VerifyConstructor(constructor, type, attributes, callingConvention, parameterTypes);
        }
        public void CallingConvention_NoRequiredOptionalCustomModifiers(CallingConventions callingConvention)
        {
            TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public);
            Type[] parameterTypes = new Type[] { typeof(int), typeof(double) };

            ConstructorBuilder cb = type.DefineConstructor(MethodAttributes.Public, callingConvention, parameterTypes);
            Assert.Equal(CallingConventions.Standard, cb.CallingConvention);
        }
        public void DefineConstructor_NullRequiredAndOptionalCustomModifiers(MethodAttributes attributes, Type[] parameterTypes, CallingConventions callingConvention)
        {
            TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public);
            ConstructorBuilder constructor = type.DefineConstructor(attributes, callingConvention, parameterTypes);
            constructor.GetILGenerator().Emit(OpCodes.Ret);

            Helpers.VerifyConstructor(constructor, type, attributes, callingConvention, parameterTypes);
        }
 internal ManagedCalliDescriptor(CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
     : base()
 {
     this.Value = string.Format(CultureInfo.CurrentCulture, "{0} {1}({2})",
         ManagedCalliDescriptor.GetConventions(callingConvention),
         new TypeDescriptor(returnType).Value,
         ManagedCalliDescriptor.GetArguments(callingConvention, parameterTypes, optionalParameterTypes));
 }
Example #22
0
 internal static SignatureHelper GetMethodSigHelper(
     Module scope, CallingConventions callingConvention,
     Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers,
     Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
 {
     return GetMethodSigHelper(scope, callingConvention, 0, returnType, requiredReturnTypeCustomModifiers, 
         optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
 }
Example #23
0
		internal MethodSignature(Type returnType, Type[] parameterTypes, Type[][][] modifiers, CallingConventions callingConvention, int genericParamCount)
		{
			this.returnType = returnType;
			this.parameterTypes = parameterTypes;
			this.modifiers = modifiers;
			this.callingConvention = callingConvention;
			this.genericParamCount = genericParamCount;
		}
 internal ConstructorBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers, ModuleBuilder mod, TypeBuilder type)
 {
     int num;
     this.m_methodBuilder = new MethodBuilder(name, attributes, callingConvention, null, null, null, parameterTypes, requiredCustomModifiers, optionalCustomModifiers, mod, type, false);
     type.m_listMethods.Add(this.m_methodBuilder);
     this.m_methodBuilder.GetMethodSignature().InternalGetSignature(out num);
     this.m_methodBuilder.GetToken();
     this.m_ReturnILGen = true;
 }
Example #25
0
		internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
		{
			this.unmanaged = unmanaged;
			this.unmanagedCallingConvention = unmanagedCallingConvention;
			this.callingConvention = callingConvention;
			this.returnType = returnType;
			this.parameterTypes = parameterTypes;
			this.optionalParameterTypes = optionalParameterTypes;
		}
		protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
								       Binder binder,
								       CallingConventions callConvention,
								       Type[] types,
								       ParameterModifier[] modifiers)
		{
			ConstructorInfo[] methods = GetConstructors (bindingAttr);
			return GetConstructorImpl (methods, bindingAttr, binder, callConvention, types, modifiers);
		}
        public void GetMethodSigHelper_Module_CallingConventions_Type_Length_ReturnsThree(CallingConventions callingConventions, Type type)
        {
            ModuleBuilder module = Helpers.DynamicModule();
            SignatureHelper helper1 = SignatureHelper.GetMethodSigHelper(module, callingConventions, type);
            Assert.Equal(3, helper1.GetSignature().Length);

            SignatureHelper helper2 = SignatureHelper.GetMethodSigHelper(null, callingConventions, type);
            Assert.Equal(3, helper2.GetSignature().Length);
        }
Example #28
0
 internal static string ConstructParameters(ParameterInfo[] parameters, CallingConventions callingConvention)
 {
     Type[] typeArray = new Type[parameters.Length];
     for (int i = 0; i < parameters.Length; i++)
     {
         typeArray[i] = parameters[i].ParameterType;
     }
     return ConstructParameters(typeArray, callingConvention);
 }
 internal MethodBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention,
     Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
     Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers,
     Module mod, TypeBuilder type, bool bIsGlobalMethod)
 {
     Init(name, attributes, callingConvention, 
         returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
         parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers,
         mod, type, bIsGlobalMethod);
 }
Example #30
0
		private PropertySignature(CallingConventions callingConvention, Type propertyType, Type[] optionalCustomModifiers, Type[] requiredCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeOptionalCustomModifiers, Type[][] parameterTypeRequiredCustomModifiers)
		{
			this.callingConvention = callingConvention;
			this.propertyType = propertyType;
			this.optionalCustomModifiers = optionalCustomModifiers;
			this.requiredCustomModifiers = requiredCustomModifiers;
			this.parameterTypes = parameterTypes;
			this.parameterOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;
			this.parameterRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
		}
Example #31
0
 public MethodBuilder DefineMethod(string name, MethodAttributes attribs, CallingConventions callingConvention)
 {
     return(CreateMethodBuilder(name, attribs, callingConvention));
 }
Example #32
0
 private MethodSignature(Type returnType, Type[] parameterTypes, Type[][][] modifiers, CallingConventions callingConvention, int genericParamCount)
 {
     this.returnType        = returnType;
     this.parameterTypes    = parameterTypes;
     this.modifiers         = modifiers;
     this.callingConvention = callingConvention;
     this.genericParamCount = genericParamCount;
 }
Example #33
0
 internal RTDynamicMethod(DynamicMethod owner, string name, MethodAttributes attributes, CallingConventions callingConvention)
 {
     m_owner             = owner;
     m_name              = name;
     m_attributes        = attributes;
     m_callingConvention = callingConvention;
 }
Example #34
0
        public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
        {
            Contract.Requires(types != null);

            return(default(ConstructorInfo));
        }
Example #35
0
 protected override MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder,
                                             CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     return(GetMethodInternal(name, bindingAttr, binder, callConvention, types, modifiers));
 }
Example #36
0
 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
                                             CallingConventions callConvention, Type[] types,
                                             ParameterModifier[] modifiers)
 {
     throw new NotSupportedException();
 }
Example #37
0
 public ConstructorBuilder DefineConstructor(MethodAttributes attribs, CallingConventions callConv, Type[] parameterTypes)
 {
     return(DefineConstructor(attribs, callConv, parameterTypes, null, null));
 }
Example #38
0
        protected sealed override ConstructorInfo?GetConstructorImpl(BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
        {
            Debug.Assert(types != null);

            QueryResult <ConstructorInfo> queryResult = Query <ConstructorInfo>(bindingAttr);
            ListBuilder <ConstructorInfo> candidates  = default;

            foreach (ConstructorInfo candidate in queryResult)
            {
                if (candidate.QualifiesBasedOnParameterCount(bindingAttr, callConvention, types))
                {
                    candidates.Add(candidate);
                }
            }

            // For perf and .NET Framework compat, fast-path these specific checks before calling on the binder to break ties.
            if (candidates.Count == 0)
            {
                return(null);
            }

            if (types.Length == 0 && candidates.Count == 1)
            {
                ConstructorInfo firstCandidate = candidates[0];
                ParameterInfo[] parameters     = firstCandidate.GetParametersNoCopy();
                if (parameters.Length == 0)
                {
                    return(firstCandidate);
                }
            }

            if ((bindingAttr & BindingFlags.ExactBinding) != 0)
            {
                return(System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo);
            }

            if (binder == null)
            {
                binder = Loader.GetDefaultBinder();
            }

            return(binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as ConstructorInfo);
        }
Example #39
0
 protected sealed override MethodInfo?GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
 {
     return(GetMethodImplCommon(name, genericParameterCount, bindingAttr, binder, callConvention, types, modifiers));
 }
Example #40
0
        private MethodInfo?GetMethodImplCommon(string name, int genericParameterCount, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
        {
            Debug.Assert(name != null);

            // GetMethodImpl() is a funnel for two groups of api. We can distinguish by comparing "types" to null.
            if (types == null)
            {
                // Group #1: This group of api accept only a name and BindingFlags. The other parameters are hard-wired by the non-virtual api entrypoints.
                Debug.Assert(genericParameterCount == GenericParameterCountAny);
                Debug.Assert(binder == null);
                Debug.Assert(callConvention == CallingConventions.Any);
                Debug.Assert(modifiers == null);
                return(Query <MethodInfo>(name, bindingAttr).Disambiguate());
            }
            else
            {
                // Group #2: This group of api takes a set of parameter types and an optional binder.
                QueryResult <MethodInfo> queryResult = Query <MethodInfo>(name, bindingAttr);
                ListBuilder <MethodInfo> candidates  = default;
                foreach (MethodInfo candidate in queryResult)
                {
                    if (genericParameterCount != GenericParameterCountAny && genericParameterCount != candidate.GetGenericParameterCount())
                    {
                        continue;
                    }
                    if (candidate.QualifiesBasedOnParameterCount(bindingAttr, callConvention, types))
                    {
                        candidates.Add(candidate);
                    }
                }

                if (candidates.Count == 0)
                {
                    return(null);
                }

                // For perf and .NET Framework compat, fast-path these specific checks before calling on the binder to break ties.
                if (types.Length == 0 && candidates.Count == 1)
                {
                    return(candidates[0]);
                }

                if (binder == null)
                {
                    binder = Loader.GetDefaultBinder();
                }
                return(binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as MethodInfo);
            }
        }
Example #41
0
        internal static __StandAloneMethodSig ReadStandAloneMethodSig(ModuleReader module, ByteReader br, IGenericContext context)
        {
            CallingConventions callingConvention = 0;

            System.Runtime.InteropServices.CallingConvention unmanagedCallingConvention = 0;
            bool unmanaged;
            byte flags = br.ReadByte();

            switch (flags & 7)
            {
            case DEFAULT:
                callingConvention = CallingConventions.Standard;
                unmanaged         = false;
                break;

            case 0x01:                          // C
                unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
                unmanaged = true;
                break;

            case 0x02:                          // STDCALL
                unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
                unmanaged = true;
                break;

            case 0x03:                          // THISCALL
                unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
                unmanaged = true;
                break;

            case 0x04:                          // FASTCALL
                unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
                unmanaged = true;
                break;

            case VARARG:
                callingConvention = CallingConventions.VarArgs;
                unmanaged         = false;
                break;

            default:
                throw new BadImageFormatException();
            }
            if ((flags & HASTHIS) != 0)
            {
                callingConvention |= CallingConventions.HasThis;
            }
            if ((flags & EXPLICITTHIS) != 0)
            {
                callingConvention |= CallingConventions.ExplicitThis;
            }
            if ((flags & GENERIC) != 0)
            {
                throw new BadImageFormatException();
            }
            int paramCount = br.ReadCompressedInt();

            SkipCustomModifiers(br);
            Type        returnType             = ReadRetType(module, br, context);
            List <Type> parameterTypes         = new List <Type>();
            List <Type> optionalParameterTypes = new List <Type>();
            List <Type> curr = parameterTypes;

            for (int i = 0; i < paramCount; i++)
            {
                if (br.PeekByte() == SENTINEL)
                {
                    br.ReadByte();
                    curr = optionalParameterTypes;
                }
                SkipCustomModifiers(br);
                curr.Add(ReadParam(module, br, context));
            }
            return(new __StandAloneMethodSig(unmanaged, unmanagedCallingConvention, callingConvention, returnType, parameterTypes.ToArray(), optionalParameterTypes.ToArray()));
        }
Example #42
0
 internal static MethodSignature MakeFromBuilder(Type returnType, Type[] parameterTypes, Type[][][] modifiers, CallingConventions callingConvention, int genericParamCount)
 {
     if (genericParamCount > 0)
     {
         returnType     = returnType.BindTypeParameters(Unbinder.Instance);
         parameterTypes = BindTypeParameters(Unbinder.Instance, parameterTypes);
         modifiers      = BindTypeParameters(Unbinder.Instance, modifiers);
     }
     return(new MethodSignature(returnType, parameterTypes, modifiers, callingConvention, genericParamCount));
 }
Example #43
0
        private unsafe void Init(string name,
                                 MethodAttributes attributes,
                                 CallingConventions callingConvention,
                                 Type returnType,
                                 Type[] signature,
                                 Type owner,
                                 Module m,
                                 bool skipVisibility,
                                 bool transparentMethod)
        {
            DynamicMethod.CheckConsistency(attributes, callingConvention);

            // check and store the signature
            if (signature != null)
            {
                m_parameterTypes = new RuntimeType[signature.Length];
                for (int i = 0; i < signature.Length; i++)
                {
                    if (signature[i] == null)
                    {
                        throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
                    }
                    m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
                    if (m_parameterTypes[i] == null || m_parameterTypes[i] == typeof(void))
                    {
                        throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
                    }
                }
            }
            else
            {
                m_parameterTypes = Array.Empty <RuntimeType>();
            }

            // check and store the return value
            m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType;
            if (m_returnType == null)
            {
                throw new NotSupportedException(SR.Arg_InvalidTypeInRetType);
            }

            if (transparentMethod)
            {
                Debug.Assert(owner == null && m == null, "owner and m cannot be set for transparent methods");
                m_module = GetDynamicMethodsModule();
                if (skipVisibility)
                {
                    m_restrictedSkipVisibility = true;
                }
            }
            else
            {
                Debug.Assert(m != null || owner != null, "Constructor should ensure that either m or owner is set");
                Debug.Assert(m == null || !m.Equals(s_anonymouslyHostedDynamicMethodsModule), "The user cannot explicitly use this assembly");
                Debug.Assert(m == null || owner == null, "m and owner cannot both be set");

                if (m != null)
                {
                    m_module = m.ModuleHandle.GetRuntimeModule(); // this returns the underlying module for all RuntimeModule and ModuleBuilder objects.
                }
                else
                {
                    RuntimeType rtOwner = null;
                    if (owner != null)
                    {
                        rtOwner = owner.UnderlyingSystemType as RuntimeType;
                    }

                    if (rtOwner != null)
                    {
                        if (rtOwner.HasElementType || rtOwner.ContainsGenericParameters ||
                            rtOwner.IsGenericParameter || rtOwner.IsInterface)
                        {
                            throw new ArgumentException(SR.Argument_InvalidTypeForDynamicMethod);
                        }

                        m_typeOwner = rtOwner;
                        m_module    = rtOwner.GetRuntimeModule();
                    }
                }

                m_skipVisibility = skipVisibility;
            }

            // initialize remaining fields
            m_ilGenerator  = null;
            m_fInitLocals  = true;
            m_methodHandle = null;

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention);
        }
Example #44
0
        internal MethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention,
                               Type?returnType, Type[]?returnTypeRequiredCustomModifiers, Type[]?returnTypeOptionalCustomModifiers,
                               Type[]?parameterTypes, Type[][]?parameterTypeRequiredCustomModifiers, Type[][]?parameterTypeOptionalCustomModifiers,
                               ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.Length == 0)
            {
                throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
            }

            if (name[0] == '\0')
            {
                throw new ArgumentException(SR.Argument_IllegalName, nameof(name));
            }

            if (mod == null)
            {
                throw new ArgumentNullException(nameof(mod));
            }

            if (parameterTypes != null)
            {
                foreach (Type t in parameterTypes)
                {
                    if (t == null)
                    {
                        throw new ArgumentNullException(nameof(parameterTypes));
                    }
                }
            }

            m_strName        = name;
            m_module         = mod;
            m_containingType = type;
            m_returnType     = returnType ?? typeof(void);

            if ((attributes & MethodAttributes.Static) == 0)
            {
                // turn on the has this calling convention
                callingConvention |= CallingConventions.HasThis;
            }
            else if ((attributes & MethodAttributes.Virtual) != 0)
            {
                // A method can't be both static and virtual
                throw new ArgumentException(SR.Arg_NoStaticVirtual);
            }

#if !FEATURE_DEFAULT_INTERFACES
            if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName)
            {
                if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface)
                {
                    // methods on interface have to be abstract + virtual except special name methods such as type initializer
                    if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) !=
                        (MethodAttributes.Abstract | MethodAttributes.Virtual) &&
                        (attributes & MethodAttributes.Static) == 0)
                    {
                        throw new ArgumentException(SR.Argument_BadAttributeOnInterfaceMethod);
                    }
                }
            }
#endif

            m_callingConvention = callingConvention;

            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, 0, m_parameterTypes, 0, parameterTypes.Length);
            }
            else
            {
                m_parameterTypes = null;
            }

            m_returnTypeRequiredCustomModifiers    = returnTypeRequiredCustomModifiers;
            m_returnTypeOptionalCustomModifiers    = returnTypeOptionalCustomModifiers;
            m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
            m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;

            // m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention,
            //                returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
            //                parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);

            m_iAttributes     = attributes;
            m_bIsGlobalMethod = bIsGlobalMethod;
            m_bIsBaked        = false;
            m_fInitLocals     = true;

            m_localSymInfo = new LocalSymInfo();
            m_ubBody       = null;
            m_ilGenerator  = null;

            // Default is managed IL. Manged IL has bit flag 0x0020 set off
            m_dwMethodImplFlags = MethodImplAttributes.IL;
        }
Example #45
0
        private MethodBuilder CreateMethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention)
        {
            this.ModuleBuilder.MethodDef.AddVirtualRecord();
            MethodBuilder mb = new MethodBuilder(this, name, attributes, callingConvention);

            methods.Add(mb);
            return(mb);
        }
Example #46
0
        private PropertyBuilder DefinePropertyImpl(string name, PropertyAttributes attributes, CallingConventions callingConvention, bool patchCallingConvention,
                                                   Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
        {
            if (properties == null)
            {
                properties = new List <PropertyBuilder>();
            }
            PropertySignature sig = PropertySignature.Create(callingConvention, returnType, parameterTypes, customModifiers);
            PropertyBuilder   pb  = new PropertyBuilder(this, name, attributes, sig, patchCallingConvention);

            properties.Add(pb);
            return(pb);
        }
 internal ConstructorBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention,
                             Type[]?parameterTypes, ModuleBuilder mod, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TypeBuilder type) :
     this(name, attributes, callingConvention, parameterTypes, null, null, mod, type)
 {
 }
Example #48
0
 public PropertyBuilder __DefineProperty(string name, PropertyAttributes attributes, CallingConventions callingConvention,
                                         Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
 {
     return(DefinePropertyImpl(name, attributes, callingConvention, false, returnType, parameterTypes,
                               PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes))));
 }
 internal PropertyBuilder(TypeBuilder tb, string name, PropertyAttributes attributes, CallingConventions callingConvention, Type returnType, Type[]?returnModReq, Type[]?returnModOpt, Type[]?parameterTypes, Type[][]?paramModReq, Type[][]?paramModOpt)
 {
     this.name              = name;
     this.attrs             = attributes;
     this.callingConvention = callingConvention;
     this.type              = returnType;
     this.returnModReq      = returnModReq;
     this.returnModOpt      = returnModOpt;
     this.paramModReq       = paramModReq;
     this.paramModOpt       = paramModOpt;
     if (parameterTypes != null)
     {
         this.parameters = new Type[parameterTypes.Length];
         Array.Copy(parameterTypes, this.parameters, this.parameters.Length);
     }
     typeb     = tb;
     table_idx = tb.get_next_table_index(this, 0x17, 1);
 }
Example #50
0
        public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention,
                                                 Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
                                                 Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers,
                                                 CallingConvention nativeCallConv, CharSet nativeCharSet)
        {
            MethodBuilder mb = DefineMethod(name, attributes | MethodAttributes.PinvokeImpl, callingConvention,
                                            returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
                                            parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);

            mb.SetDllImportPseudoCustomAttribute(dllName, entryName, nativeCallConv, nativeCharSet, null, null, null, null, null);
            return(mb);
        }
Example #51
0
 public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
 {
     return(IsResource() ? null : GetModuleType().GetMethod(name, bindingAttr, binder, callConv, types, modifiers));
 }
Example #52
0
 public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
 {
     return(DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, nativeCallConv, nativeCharSet));
 }
 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[] types, ParameterModifier[]?modifiers)
 {
     throw new NotSupportedException();
 }
Example #54
0
 public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
 {
     return(DefineMethod(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null));
 }
Example #55
0
 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
                                                       CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
 {
     return(m_typeBuilder.GetConstructor(bindingAttr, binder, callConvention,
                                         types, modifiers));
 }
Example #56
0
        internal static MethodSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
        {
            CallingConventions callingConvention;
            int  genericParamCount;
            Type returnType;

            Type[] parameterTypes;
            byte   flags = br.ReadByte();

            switch (flags & 7)
            {
            case DEFAULT:
                callingConvention = CallingConventions.Standard;
                break;

            case VARARG:
                callingConvention = CallingConventions.VarArgs;
                break;

            default:
                throw new BadImageFormatException();
            }
            if ((flags & HASTHIS) != 0)
            {
                callingConvention |= CallingConventions.HasThis;
            }
            if ((flags & EXPLICITTHIS) != 0)
            {
                callingConvention |= CallingConventions.ExplicitThis;
            }
            genericParamCount = 0;
            if ((flags & GENERIC) != 0)
            {
                genericParamCount = br.ReadCompressedInt();
                context           = new UnboundGenericMethodContext(context);
            }
            int paramCount = br.ReadCompressedInt();

            Type[][][] modifiers = null;
            Type[]     optionalCustomModifiers;
            Type[]     requiredCustomModifiers;
            ReadCustomModifiers(module, br, context, out requiredCustomModifiers, out optionalCustomModifiers);
            returnType     = ReadRetType(module, br, context);
            parameterTypes = new Type[paramCount];
            PackedCustomModifiers.SetModifiers(ref modifiers, 0, 0, optionalCustomModifiers, paramCount + 1);
            PackedCustomModifiers.SetModifiers(ref modifiers, 0, 1, requiredCustomModifiers, paramCount + 1);
            for (int i = 0; i < parameterTypes.Length; i++)
            {
                if ((callingConvention & CallingConventions.VarArgs) != 0 && br.PeekByte() == SENTINEL)
                {
                    Array.Resize(ref parameterTypes, i);
                    if (modifiers != null)
                    {
                        Array.Resize(ref modifiers, i + 1);
                    }
                    break;
                }
                ReadCustomModifiers(module, br, context, out requiredCustomModifiers, out optionalCustomModifiers);
                PackedCustomModifiers.SetModifiers(ref modifiers, i + 1, 0, optionalCustomModifiers, paramCount + 1);
                PackedCustomModifiers.SetModifiers(ref modifiers, i + 1, 1, requiredCustomModifiers, paramCount + 1);
                parameterTypes[i] = ReadParam(module, br, context);
            }
            return(new MethodSignature(returnType, parameterTypes, modifiers, callingConvention, genericParamCount));
        }
Example #57
0
        MethodInfo?GetMethodImpl(string name, BindingFlags bindingAttr, Binder?binder, CallingConventions callConvention, Type[]?types, ParameterModifier[]?modifiers)
        {
            if (IsResource())
            {
                return(null);
            }

            Type globalType = GetGlobalType(_impl);

            if (globalType == null)
            {
                return(null);
            }
            if (types == null)
            {
                return(globalType.GetMethod(name));
            }
            return(globalType.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers));
        }
Example #58
0
 /// <inheritdoc />
 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
 => null;
Example #59
0
 /// <inheritdoc />
 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
 => null;
 [System.Security.SecurityCritical]  // auto-generated
 internal ConstructorBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention,
                             Type[] parameterTypes, ModuleBuilder mod, TypeBuilder type) :
     this(name, attributes, callingConvention, parameterTypes, null, null, mod, type)
 {
 }