2007-08-09 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                 MemberCache IMemberContainer.MemberCache {
142                         get { throw new NotImplementedException (); }
143                 }
144
145                 public bool IsSubclassOf (Type t)
146                 {
147                         throw new NotImplementedException ();
148                 }
149
150                 public MemberList FindMembers (MemberTypes mt, BindingFlags bf,
151                                                MemberFilter filter, object criteria)
152                 {
153                         throw new NotImplementedException ();
154                 }
155         }
156
157         public class TypeParameterExpr : TypeExpr
158         {
159                 public override string Name {
160                         get { throw new NotImplementedException (); }
161                 }
162
163                 public override string FullName {
164                         get { throw new NotImplementedException (); }
165                 }
166
167                 public TypeParameterExpr (TypeParameter type_parameter, Location loc)
168                 {
169                         throw new NotImplementedException ();
170                 }
171
172                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
173                 {
174                         return null;
175                 }
176         }
177
178         public class TypeParameterName : SimpleName
179         {
180                 Attributes attributes;
181
182                 public TypeParameterName (string name, Attributes attrs, Location loc)
183                         : base (name, loc)
184                 {
185                         attributes = attrs;
186                 }
187
188                 public Attributes OptAttributes {
189                         get {
190                                 return attributes;
191                         }
192                 }
193         }
194
195         public class ConstructedType : TypeExpr
196         {
197                 public ConstructedType (FullNamedExpression fname, TypeArguments args, Location l)
198                 {
199                         throw new NotImplementedException ();
200                 }
201
202                 public ConstructedType (Type t, TypeParameter[] type_params, Location l)
203                 {
204                         throw new NotImplementedException ();
205                 }
206
207                 public ConstructedType (Type t, TypeArguments args, Location l)
208                 {
209                         throw new NotImplementedException ();
210                 }
211
212                 public override string Name {
213                         get { throw new NotImplementedException (); }
214                 }
215
216                 public override string FullName {
217                         get { throw new NotImplementedException (); }
218                 }
219
220                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
221                 {
222                         throw new NotImplementedException ();
223                 }
224
225                 public bool CheckConstraints (IResolveContext ec)
226                 {
227                         throw new NotImplementedException ();
228                 }
229         }
230
231         public class GenericMethod : DeclSpace
232         {
233                 public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
234                                       Expression return_type, Parameters parameters)
235                         : base (ns, parent, name, null)
236                 {
237                         throw new NotImplementedException ();
238                 }
239
240                 public override TypeBuilder DefineType ()
241                 {
242                         throw new NotImplementedException ();
243                 }
244
245                 public override bool Define ()
246                 {
247                         throw new NotImplementedException ();
248                 }
249
250                 public bool DefineType (EmitContext ec, MethodBuilder mb,
251                                         MethodInfo implementing, bool is_override)
252                 {
253                         throw new NotImplementedException ();
254                 }
255
256                 public void EmitAttributes ()
257                 {
258                         throw new NotImplementedException ();
259                 }
260
261                 public override bool DefineMembers ()
262                 {
263                         throw new NotImplementedException ();
264                 }
265
266                 public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
267                                                         MemberFilter filter, object criteria)
268                 {
269                         throw new NotImplementedException ();
270                 }               
271
272                 public override MemberCache MemberCache {
273                         get { throw new NotImplementedException (); }
274                 }
275
276                 public override AttributeTargets AttributeTargets {
277                         get {
278                                 return AttributeTargets.Method | AttributeTargets.ReturnValue;
279                         }
280                 }
281
282                 public override string DocCommentHeader {
283                         get { return "M:"; }
284                 }
285
286                 public new void VerifyClsCompliance ()
287                 {
288                         throw new NotImplementedException ();
289                 }
290         }
291
292         public class TypeArguments
293         {
294                 public TypeArguments (Location loc)
295                 {
296                         throw new NotImplementedException ();
297                 }
298                 
299                 public TypeArguments (Location loc, params Expression[] types)
300                 {
301                         throw new NotImplementedException ();
302                 }               
303
304                 public void Add (Expression type)
305                 {
306                         throw new NotImplementedException ();
307                 }
308
309                 public void Add (TypeArguments new_args)
310                 {
311                         throw new NotImplementedException ();
312                 }
313
314                 public bool Resolve (IResolveContext ec)
315                 {
316                         throw new NotImplementedException ();
317                 }
318
319                 public Type[] Arguments {
320                         get { throw new NotImplementedException (); }
321                 }
322
323                 public int Count {
324                         get { throw new NotImplementedException (); }
325                 }
326
327                 public bool IsUnbound {
328                         get { throw new NotImplementedException (); }
329                 }
330
331                 public TypeParameterName[] GetDeclarations ()
332                 {
333                         throw new NotImplementedException ();
334                 }
335                 
336                 public string GetSignatureForError ()
337                 {
338                         throw new NotImplementedException ();
339                 }
340
341                 public TypeArguments Clone ()
342                 {
343                         throw new NotImplementedException ();
344                 }
345         }
346
347         public class TypeInferenceContext
348         {
349                 public void ExactInference (Type u, Type v)
350                 {
351                         throw new NotImplementedException ();
352                 }
353         }
354 }