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