2007-10-20 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / generic.cs
1 //
2 // generic.cs: Support classes for generics to reduce differences from GMCS
3 //
4 // Author:
5 //   Raja R Harinath <rharinath@novell.com>
6 //
7 // (C) 2006 Novell, Inc.
8 //
9 using System;
10 using System.Reflection;
11 using System.Reflection.Emit;
12 using System.Collections;
13
14 namespace Mono.CSharp
15 {
16         public abstract class GenericConstraints
17         {
18                 public abstract string TypeParameter {
19                         get;
20                 }
21
22                 public bool IsReferenceType { 
23                         get { throw new NotSupportedException (); }
24                 }
25         }
26
27         public abstract class Constraints : GenericConstraints
28         {
29                 public Constraints Clone ()
30                 {
31                         throw new NotImplementedException ();
32                 }
33
34                 public abstract Location Location {
35                         get;
36                 }
37
38                 public abstract void VerifyClsCompliance ();
39         }
40
41         public class TypeParameter : MemberCore, IMemberContainer
42         {
43                 public TypeParameter (DeclSpace parent, DeclSpace decl, string name,
44                                       Constraints constraints, Attributes attrs, Location loc)
45                         : base (parent, new MemberName (name, loc), attrs)
46                 {
47                         throw new NotImplementedException ();
48                 }
49
50                 public static string GetSignatureForError (TypeParameter[] tp)
51                 {
52                         throw new NotImplementedException ();
53                 }
54
55                 //
56                 // MemberContainer
57                 //
58
59                 public override bool Define ()
60                 {
61                         return true;
62                 }
63
64                 public override void ApplyAttributeBuilder (Attribute a,
65                                                             CustomAttributeBuilder cb)
66                 {
67                         throw new NotImplementedException ();
68                 }
69
70                 public override AttributeTargets AttributeTargets {
71                         get { throw new NotImplementedException (); }
72                 }
73
74                 public override string[] ValidAttributeTargets {
75                         get {
76                                 return new string [] { "type parameter" };
77                         }
78                 }
79
80                 public Constraints Constraints {
81                         get {
82                                 return null;
83                         }
84                 }
85
86                 public override string DocCommentHeader {
87                         get { throw new NotImplementedException (); }
88                 }
89
90                 public bool Resolve (DeclSpace ds)
91                 {
92                         throw new NotImplementedException ();
93                 }
94
95                 public bool DefineType (IResolveContext ec)
96                 {
97                         throw new NotImplementedException ();
98                 }
99
100                 public bool DefineType (IResolveContext ec, MethodBuilder builder,
101                                         MethodInfo implementing, bool is_override)
102                 {
103                         throw new NotImplementedException ();
104                 }
105
106                 public bool CheckDependencies ()
107                 {
108                         throw new NotImplementedException ();
109                 }
110
111                 public bool UpdateConstraints (IResolveContext ec, Constraints new_constraints)
112                 {
113                         throw new NotImplementedException ();
114                 }
115
116                 //
117                 // IMemberContainer
118                 //
119
120                 Type IMemberContainer.Type {
121                         get { throw new NotImplementedException (); }
122                 }
123
124                 string IMemberContainer.Name {
125                         get { throw new NotImplementedException (); }
126                 }
127
128                 MemberCache IMemberContainer.BaseCache {
129                         get { throw new NotImplementedException (); }
130                 }
131
132                 bool IMemberContainer.IsInterface {
133                         get { throw new NotImplementedException (); }
134                 }
135
136                 MemberList IMemberContainer.GetMembers (MemberTypes mt, BindingFlags bf)
137                 {
138                         throw new NotImplementedException ();
139                 }
140
141                 public bool IsSubclassOf (Type t)
142                 {
143                         throw new NotImplementedException ();
144                 }
145
146                 public MemberList FindMembers (MemberTypes mt, BindingFlags bf,
147                                                MemberFilter filter, object criteria)
148                 {
149                         throw new NotImplementedException ();
150                 }
151         }
152
153         public class TypeParameterExpr : TypeExpr
154         {
155                 public override string Name {
156                         get { throw new NotImplementedException (); }
157                 }
158
159                 public override string FullName {
160                         get { throw new NotImplementedException (); }
161                 }
162
163                 public TypeParameterExpr (TypeParameter type_parameter, Location loc)
164                 {
165                         throw new NotImplementedException ();
166                 }
167
168                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
169                 {
170                         return null;
171                 }
172         }
173
174         public class TypeParameterName : SimpleName
175         {
176                 Attributes attributes;
177
178                 public TypeParameterName (string name, Attributes attrs, Location loc)
179                         : base (name, loc)
180                 {
181                         attributes = attrs;
182                 }
183
184                 public Attributes OptAttributes {
185                         get {
186                                 return attributes;
187                         }
188                 }
189         }
190
191         public class ConstructedType : TypeExpr
192         {
193                 public ConstructedType (FullNamedExpression fname, TypeArguments args, Location l)
194                 {
195                         throw new NotImplementedException ();
196                 }
197
198                 public ConstructedType (Type t, TypeParameter[] type_params, Location l)
199                 {
200                         throw new NotImplementedException ();
201                 }
202
203                 public ConstructedType (Type t, TypeArguments args, Location l)
204                 {
205                         throw new NotImplementedException ();
206                 }
207
208                 public override string Name {
209                         get { throw new NotImplementedException (); }
210                 }
211
212                 public override string FullName {
213                         get { throw new NotImplementedException (); }
214                 }
215
216                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
217                 {
218                         throw new NotImplementedException ();
219                 }
220
221                 public bool CheckConstraints (IResolveContext ec)
222                 {
223                         throw new NotImplementedException ();
224                 }
225         }
226
227         public class GenericMethod : DeclSpace
228         {
229                 public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
230                                       Expression return_type, Parameters parameters)
231                         : base (ns, parent, name, null)
232                 {
233                         throw new NotImplementedException ();
234                 }
235
236                 public override TypeBuilder DefineType ()
237                 {
238                         throw new NotImplementedException ();
239                 }
240
241                 public override bool Define ()
242                 {
243                         throw new NotImplementedException ();
244                 }
245
246                 public bool DefineType (EmitContext ec, MethodBuilder mb,
247                                         MethodInfo implementing, bool is_override)
248                 {
249                         throw new NotImplementedException ();
250                 }
251
252                 public void EmitAttributes ()
253                 {
254                         throw new NotImplementedException ();
255                 }
256
257                 public override bool DefineMembers ()
258                 {
259                         throw new NotImplementedException ();
260                 }
261                 
262                 internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
263                 {
264                 }
265
266                 public override MemberCache MemberCache {
267                         get { throw new NotImplementedException (); }
268                 }
269
270                 public override AttributeTargets AttributeTargets {
271                         get {
272                                 return AttributeTargets.Method | AttributeTargets.ReturnValue;
273                         }
274                 }
275
276                 public override string DocCommentHeader {
277                         get { return "M:"; }
278                 }
279
280                 public new void VerifyClsCompliance ()
281                 {
282                         throw new NotImplementedException ();
283                 }
284         }
285
286         public class TypeArguments
287         {
288                 public TypeArguments (Location loc)
289                 {
290                         throw new NotImplementedException ();
291                 }
292                 
293                 public TypeArguments (Location loc, params Expression[] types)
294                 {
295                         throw new NotImplementedException ();
296                 }               
297
298                 public void Add (Expression type)
299                 {
300                         throw new NotImplementedException ();
301                 }
302
303                 public void Add (TypeArguments new_args)
304                 {
305                         throw new NotImplementedException ();
306                 }
307
308                 public bool Resolve (IResolveContext ec)
309                 {
310                         throw new NotImplementedException ();
311                 }
312
313                 public Type[] Arguments {
314                         get { throw new NotImplementedException (); }
315                 }
316
317                 public int Count {
318                         get { throw new NotImplementedException (); }
319                 }
320
321                 public bool IsUnbound {
322                         get { throw new NotImplementedException (); }
323                 }
324
325                 public TypeParameterName[] GetDeclarations ()
326                 {
327                         throw new NotImplementedException ();
328                 }
329                 
330                 public string GetSignatureForError ()
331                 {
332                         throw new NotImplementedException ();
333                 }
334
335                 public TypeArguments Clone ()
336                 {
337                         throw new NotImplementedException ();
338                 }
339         }
340
341         public class TypeInferenceContext
342         {
343                 public void ExactInference (Type u, Type v)
344                 {
345                         throw new NotImplementedException ();
346                 }
347                 
348                 public Type InflateGenericArgument (Type t)
349                 {
350                         throw new NotImplementedException ();           
351                 }
352         }
353 }