2 Copyright (C) 2008-2011 Jeroen Frijters
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
26 namespace IKVM.Reflection.Emit
28 public sealed class ConstructorBuilder : ConstructorInfo
30 private readonly MethodBuilder methodBuilder;
32 internal ConstructorBuilder(MethodBuilder mb)
34 this.methodBuilder = mb;
37 public override bool Equals(object obj)
39 ConstructorBuilder other = obj as ConstructorBuilder;
40 return other != null && other.methodBuilder.Equals(methodBuilder);
43 public override int GetHashCode()
45 return methodBuilder.GetHashCode();
48 public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
50 methodBuilder.__SetSignature(returnType, returnTypeCustomModifiers, parameterTypes, parameterTypeCustomModifiers);
53 [Obsolete("Please use __SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
54 public void __SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
56 methodBuilder.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
59 public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
61 return methodBuilder.DefineParameter(position, attributes, strParamName);
64 public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
66 methodBuilder.SetCustomAttribute(customBuilder);
69 public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
71 methodBuilder.SetCustomAttribute(con, binaryAttribute);
74 public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
76 methodBuilder.__AddDeclarativeSecurity(customBuilder);
79 public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
81 methodBuilder.AddDeclarativeSecurity(securityAction, permissionSet);
84 public void SetImplementationFlags(MethodImplAttributes attributes)
86 methodBuilder.SetImplementationFlags(attributes);
89 public ILGenerator GetILGenerator()
91 return methodBuilder.GetILGenerator();
94 public ILGenerator GetILGenerator(int streamSize)
96 return methodBuilder.GetILGenerator(streamSize);
99 public void __ReleaseILGenerator()
101 methodBuilder.__ReleaseILGenerator();
104 public Type ReturnType
106 get { return methodBuilder.ReturnType; }
109 public Module GetModule()
111 return methodBuilder.GetModule();
114 public MethodToken GetToken()
116 return methodBuilder.GetToken();
119 public bool InitLocals
121 get { return methodBuilder.InitLocals; }
122 set { methodBuilder.InitLocals = value; }
125 internal override MethodInfo GetMethodInfo()
127 return methodBuilder;
130 internal override MethodInfo GetMethodOnTypeDefinition()
132 return methodBuilder;