Babel.Compiler.TypeElementCreatingVisitor.DefineConstructor C# (CSharp) 메소드

DefineConstructor() 보호된 메소드

protected DefineConstructor ( TypeBuilder type, MethodAttributes attributes, CallingConventions callingConventions, Type paramTypes ) : ConstructorBuilder
type System.Reflection.Emit.TypeBuilder
attributes MethodAttributes
callingConventions CallingConventions
paramTypes System.Type
리턴 System.Reflection.Emit.ConstructorBuilder
        protected virtual ConstructorBuilder DefineConstructor(TypeBuilder type,
                              MethodAttributes attributes,
                              CallingConventions callingConventions,
                              Type[] paramTypes)
        {
            ConstructorBuilder constructor =
                type.DefineConstructor(attributes,
                                       callingConventions,
                                       paramTypes);
            ParameterInfo[] parameters = new ParameterInfo[paramTypes.Length];
            ArrayList parameterList = new ArrayList();
            for (int i = 0; i < parameters.Length; i++) {
                ParameterBuilder pb =
                    constructor.DefineParameter(i + 1, 0, null);
                parameters[i] =
                    new Parameter(pb, paramTypes[i], constructor);
                UserDefinedParameterData paramData =
                    new UserDefinedParameterData(typeManager,
                                                 parameters[i],
                                                 ArgumentMode.In);
                parameterList.Add(paramData);
            }
            UserDefinedConstructorData constructorData =
                typeManager.AddConstructor(type, constructor);
            typeManager.AddParameters(constructor, parameters);
            constructorData.Parameters = parameterList;
            return constructor;
        }