Update mcs/class/System.Core/System/TimeZoneInfo.cs
[mono.git] / mcs / class / IKVM.Reflection / Emit / ConstructorBuilder.cs
1 /*
2   Copyright (C) 2008-2011 Jeroen Frijters
3
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.
7
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:
11
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.
19
20   Jeroen Frijters
21   jeroen@frijters.net
22   
23 */
24 using System;
25
26 namespace IKVM.Reflection.Emit
27 {
28         public sealed class ConstructorBuilder : ConstructorInfo
29         {
30                 private readonly MethodBuilder methodBuilder;
31
32                 internal ConstructorBuilder(MethodBuilder mb)
33                 {
34                         this.methodBuilder = mb;
35                 }
36
37                 public override bool Equals(object obj)
38                 {
39                         ConstructorBuilder other = obj as ConstructorBuilder;
40                         return other != null && other.methodBuilder.Equals(methodBuilder);
41                 }
42
43                 public override int GetHashCode()
44                 {
45                         return methodBuilder.GetHashCode();
46                 }
47
48                 public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
49                 {
50                         methodBuilder.__SetSignature(returnType, returnTypeCustomModifiers, parameterTypes, parameterTypeCustomModifiers);
51                 }
52
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)
55                 {
56                         methodBuilder.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
57                 }
58
59                 public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
60                 {
61                         return methodBuilder.DefineParameter(position, attributes, strParamName);
62                 }
63
64                 public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
65                 {
66                         methodBuilder.SetCustomAttribute(customBuilder);
67                 }
68
69                 public void SetCustomAttribute(ConstructorInfo con,     byte[] binaryAttribute)
70                 {
71                         methodBuilder.SetCustomAttribute(con, binaryAttribute);
72                 }
73
74                 public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
75                 {
76                         methodBuilder.__AddDeclarativeSecurity(customBuilder);
77                 }
78
79                 public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
80                 {
81                         methodBuilder.AddDeclarativeSecurity(securityAction, permissionSet);
82                 }
83
84                 public void SetImplementationFlags(MethodImplAttributes attributes)
85                 {
86                         methodBuilder.SetImplementationFlags(attributes);
87                 }
88
89                 public ILGenerator GetILGenerator()
90                 {
91                         return methodBuilder.GetILGenerator();
92                 }
93
94                 public ILGenerator GetILGenerator(int streamSize)
95                 {
96                         return methodBuilder.GetILGenerator(streamSize);
97                 }
98
99                 public void __ReleaseILGenerator()
100                 {
101                         methodBuilder.__ReleaseILGenerator();
102                 }
103
104                 public Type ReturnType
105                 {
106                         get { return methodBuilder.ReturnType; }
107                 }
108
109                 public Module GetModule()
110                 {
111                         return methodBuilder.GetModule();
112                 }
113
114                 public MethodToken GetToken()
115                 {
116                         return methodBuilder.GetToken();
117                 }
118
119                 public bool InitLocals
120                 {
121                         get { return methodBuilder.InitLocals; }
122                         set { methodBuilder.InitLocals = value; }
123                 }
124
125                 internal override MethodInfo GetMethodInfo()
126                 {
127                         return methodBuilder;
128                 }
129
130                 internal override MethodInfo GetMethodOnTypeDefinition()
131                 {
132                         return methodBuilder;
133                 }
134         }
135 }