2008-03-27 Marek Safar <marek.safar@gmail.com>
[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 // (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 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                 Type IMemberContainer.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 override string Name {
179                         get { throw new NotImplementedException (); }
180                 }
181
182                 public override string FullName {
183                         get { throw new NotImplementedException (); }
184                 }
185
186                 public TypeParameterExpr (TypeParameter type_parameter, Location loc)
187                 {
188                         throw new NotImplementedException ();
189                 }
190
191                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
192                 {
193                         return null;
194                 }
195         }
196
197         public class TypeParameterName : SimpleName
198         {
199                 Attributes attributes;
200
201                 public TypeParameterName (string name, Attributes attrs, Location loc)
202                         : base (name, loc)
203                 {
204                         attributes = attrs;
205                 }
206
207                 public Attributes OptAttributes {
208                         get {
209                                 return attributes;
210                         }
211                 }
212         }
213
214         public class ConstructedType : TypeExpr
215         {
216                 public ConstructedType (FullNamedExpression fname, TypeArguments args, Location l)
217                 {
218                         throw new NotImplementedException ();
219                 }
220
221                 public ConstructedType (Type t, TypeParameter[] type_params, Location l)
222                 {
223                         throw new NotImplementedException ();
224                 }
225
226                 public ConstructedType (Type t, TypeArguments args, Location l)
227                 {
228                         throw new NotImplementedException ();
229                 }
230
231                 public override string Name {
232                         get { throw new NotImplementedException (); }
233                 }
234
235                 public override string FullName {
236                         get { throw new NotImplementedException (); }
237                 }
238
239                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
240                 {
241                         throw new NotImplementedException ();
242                 }
243
244                 public bool CheckConstraints (IResolveContext ec)
245                 {
246                         throw new NotImplementedException ();
247                 }
248         }
249
250         public class GenericMethod : DeclSpace
251         {
252                 public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
253                                       Expression return_type, Parameters parameters)
254                         : base (ns, parent, name, null)
255                 {
256                         throw new NotImplementedException ();
257                 }
258
259                 public override TypeBuilder DefineType ()
260                 {
261                         throw new NotImplementedException ();
262                 }
263
264                 public override bool Define ()
265                 {
266                         throw new NotImplementedException ();
267                 }
268
269                 public bool DefineType (EmitContext ec, MethodBuilder mb,
270                                         MethodInfo implementing, bool is_override)
271                 {
272                         throw new NotImplementedException ();
273                 }
274
275                 public void EmitAttributes ()
276                 {
277                         throw new NotImplementedException ();
278                 }
279
280                 public override bool DefineMembers ()
281                 {
282                         throw new NotImplementedException ();
283                 }
284                 
285                 internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
286                 {
287                 }
288
289                 public override MemberCache MemberCache {
290                         get { throw new NotImplementedException (); }
291                 }
292
293                 public override AttributeTargets AttributeTargets {
294                         get {
295                                 return AttributeTargets.Method | AttributeTargets.ReturnValue;
296                         }
297                 }
298
299                 public override string DocCommentHeader {
300                         get { return "M:"; }
301                 }
302
303                 public new void VerifyClsCompliance ()
304                 {
305                         throw new NotImplementedException ();
306                 }
307         }
308
309         public class TypeArguments
310         {
311                 public readonly Location Location;
312                 ArrayList args;
313                 //Type[] atypes;
314                 int dimension;
315                 //bool has_type_args;
316                 //bool created;
317                 
318                 public TypeArguments (Location loc)
319                 {
320                         args = new ArrayList ();
321                         this.Location = loc;
322                 }
323
324                 public TypeArguments (Location loc, params Expression[] types)
325                 {
326                         this.Location = loc;
327                         this.args = new ArrayList (types);
328                 }
329                 
330                 public TypeArguments (int dimension, Location loc)
331                 {
332                         this.dimension = dimension;
333                         this.Location = loc;
334                 }
335
336                 public void Add (Expression type)
337                 {
338                 }
339
340                 public void Add (TypeArguments new_args)
341                 {
342                 }
343
344                 public bool Resolve (IResolveContext ec)
345                 {
346                         throw new NotImplementedException ();
347                 }
348
349                 public Type[] Arguments {
350                         get { throw new NotImplementedException (); }
351                 }
352
353                 public int Count {
354                         get {
355                                 if (dimension > 0)
356                                         return dimension;
357                                 else
358                                         return args.Count;
359                         }
360                 }
361
362                 public bool IsUnbound {
363                         get { throw new NotImplementedException (); }
364                 }
365
366                 public TypeParameterName[] GetDeclarations ()
367                 {
368                         throw new NotImplementedException ();
369                 }
370                 
371                 public string GetSignatureForError ()
372                 {
373                         throw new NotImplementedException ();
374                 }
375
376                 public TypeArguments Clone ()
377                 {
378                         throw new NotImplementedException ();
379                 }
380         }
381
382         public class TypeInferenceContext
383         {
384                 public void ExactInference (Type u, Type v)
385                 {
386                         throw new NotImplementedException ();
387                 }
388                 
389                 public Type InflateGenericArgument (Type t)
390                 {
391                         throw new NotImplementedException ();           
392                 }
393         }
394         
395         public class Nullable
396         {
397                 public class NullCoalescingOperator : Expression
398                 {
399                         public NullCoalescingOperator (Expression left, Expression right, Location loc)
400                         {
401                         }
402                         
403                         public override Expression DoResolve (EmitContext ec)
404                         {
405                                 throw new NotImplementedException ();
406                         }
407                         
408                         public override void Emit (EmitContext ec)
409                         {
410                                 throw new NotImplementedException ();
411                         }
412                 }
413                 
414                 public class LiftedBinaryOperator : Binary
415                 {
416                         public LiftedBinaryOperator (Binary.Operator op, Expression left, Expression right, Location loc)
417                                 : base (op, left, right)
418                         {
419                         }
420                         
421                         public override Expression DoResolve (EmitContext ec)
422                         {
423                                 throw new NotImplementedException ();
424                         }
425
426                         public override void Emit (EmitContext ec)
427                         {
428                                 throw new NotImplementedException ();
429                         }
430                 }
431                 
432                 public class Null : Expression
433                 {
434                         public Null (Type target_type, Location loc)
435                         {
436                         }
437                         
438                         public override Expression DoResolve (EmitContext ec)
439                         {
440                                 throw new NotImplementedException ();
441                         }
442
443                         public override void Emit (EmitContext ec)
444                         {
445                                 throw new NotImplementedException ();
446                         }
447                 }
448                 
449                 public class Unwrap : Expression
450                 {
451                         public override Expression DoResolve (EmitContext ec)
452                         {
453                                 throw new NotImplementedException ();
454                         }
455                         
456                         public override void Emit (EmitContext ec)
457                         {
458                                 throw new NotImplementedException ();
459                         }
460                 }
461                 
462                 public class HasValue
463                 {
464                         public static Expression Create (Expression expr, EmitContext ec)
465                         {
466                                 throw new NotImplementedException ();
467                         }
468                 }
469         }
470 }