2008-05-01 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mcs / class / corlib / System.Reflection.Emit / ConstructorOnTypeBuilderInst.cs
1 //
2 // System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs
3 //
4 // Author:
5 //   Zoltan Varga (vargaz@gmail.com)
6 //
7 //
8 // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //
29
30 using System;
31 using System.Globalization;
32 using System.Reflection;
33
34 #if NET_2_0
35
36 namespace System.Reflection.Emit
37 {
38         /*
39          * This class represents a ctor of an instantiation of a generic type builder.
40          */
41         internal class ConstructorOnTypeBuilderInst : ConstructorInfo
42         {
43                 #region Keep in sync with object-internals.h
44                 MonoGenericClass instantiation;
45                 ConstructorBuilder cb;
46                 #endregion
47
48                 public ConstructorOnTypeBuilderInst (MonoGenericClass instantiation, ConstructorBuilder cb)
49                 {
50                         this.instantiation = instantiation;
51                         this.cb = cb;
52                 }
53
54                 //
55                 // MemberInfo members
56                 //
57                 
58                 public override Type DeclaringType {
59                         get {
60                                 return instantiation;
61                         }
62                 }
63
64                 public override string Name {
65                         get {
66                                 return cb.Name;
67                         }
68                 }
69
70                 public override Type ReflectedType {
71                         get {
72                                 return instantiation;
73                         }
74                 }
75
76                 public override bool IsDefined (Type attributeType, bool inherit)
77                 {
78                         return cb.IsDefined (attributeType, inherit);
79                 }
80
81                 public override object [] GetCustomAttributes (bool inherit)
82                 {
83                         return cb.GetCustomAttributes (inherit);
84                 }
85
86                 public override object [] GetCustomAttributes (Type attributeType, bool inherit)
87                 {
88                         return cb.GetCustomAttributes (attributeType, inherit);
89                 }
90
91                 //
92                 // MethodBase members
93                 //
94
95                 public override MethodImplAttributes GetMethodImplementationFlags ()
96                 {
97                         return cb.GetMethodImplementationFlags ();
98                 }
99
100                 public override ParameterInfo[] GetParameters ()
101                 {
102                         return cb.GetParameters ();
103                 }
104
105                 internal override int GetParameterCount ()
106                 {
107                         return cb.GetParameterCount ();
108                 }
109
110                 public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
111                 {
112                         return cb.Invoke (obj, invokeAttr, binder, parameters,
113                                 culture);
114                 }
115
116                 public override RuntimeMethodHandle MethodHandle {
117                         get {
118                                 return cb.MethodHandle;
119                         }
120                 }
121
122                 public override MethodAttributes Attributes {
123                         get {
124                                 return cb.Attributes;
125                         }
126                 }
127
128                 public override CallingConventions CallingConvention {
129                         get {
130                                 return cb.CallingConvention;
131                         }
132                 }
133
134                 public override Type [] GetGenericArguments ()
135                 {
136                         return cb.GetGenericArguments ();
137                 }
138
139                 public override bool ContainsGenericParameters {
140                         get {
141                                 return false;
142                         }
143                 }
144
145                 public override bool IsGenericMethodDefinition {
146                         get {
147                                 return false;
148                         }
149                 }
150
151                 public override bool IsGenericMethod {
152                         get {
153                                 return false;
154                         }
155                 }
156
157                 //
158                 // MethodBase members
159                 //
160
161                 public override object Invoke (BindingFlags invokeAttr, Binder binder, object[] parameters,
162                                                                            CultureInfo culture)
163                 {
164                         throw new InvalidOperationException ();
165                 }
166         }
167 }
168
169 #endif\r