Flush
[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 GenericTypeExpr : TypeExpr
213         {
214                 public GenericTypeExpr (DeclSpace t, Location l)
215                 {
216                         throw new NotImplementedException ();
217                 }
218
219                 public GenericTypeExpr (Type t, TypeArguments args, Location l)
220                 {
221                         throw new NotImplementedException ();
222                 }
223
224                 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
225                 {
226                         throw new NotImplementedException ();
227                 }
228
229                 public bool CheckConstraints (IResolveContext ec)
230                 {
231                         throw new NotImplementedException ();
232                 }
233         }
234
235         public class GenericMethod : DeclSpace
236         {
237                 public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
238                                       Expression return_type, Parameters parameters)
239                         : base (ns, parent, name, null)
240                 {
241                         throw new NotImplementedException ();
242                 }
243
244                 public override TypeBuilder DefineType ()
245                 {
246                         throw new NotImplementedException ();
247                 }
248
249                 public override bool Define ()
250                 {
251                         throw new NotImplementedException ();
252                 }
253
254                 public bool DefineType (EmitContext ec, MethodBuilder mb,
255                                         MethodInfo implementing, bool is_override)
256                 {
257                         throw new NotImplementedException ();
258                 }
259
260                 public void EmitAttributes ()
261                 {
262                         throw new NotImplementedException ();
263                 }
264
265                 internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
266                 {
267                 }
268
269                 public override MemberCache MemberCache {
270                         get { throw new NotImplementedException (); }
271                 }
272
273                 public override AttributeTargets AttributeTargets {
274                         get {
275                                 return AttributeTargets.Method | AttributeTargets.ReturnValue;
276                         }
277                 }
278
279                 public override string DocCommentHeader {
280                         get { return "M:"; }
281                 }
282
283                 public new void VerifyClsCompliance ()
284                 {
285                         throw new NotImplementedException ();
286                 }
287         }
288
289         public class TypeArguments
290         {
291                 ArrayList args;
292                 
293                 public TypeArguments ()
294                 {
295                         args = new ArrayList ();
296                 }
297
298                 public TypeArguments (params Expression[] types)
299                 {
300                         args = new ArrayList (types);
301                 }
302                 
303                 public void Add (Expression type)
304                 {
305                 }
306
307                 public void Add (TypeArguments new_args)
308                 {
309                 }
310
311                 public bool Resolve (IResolveContext ec)
312                 {
313                         throw new NotImplementedException ();
314                 }
315
316                 public Type[] Arguments {
317                         get { throw new NotImplementedException (); }
318                 }
319
320                 public int Count {
321                         get {
322                                 return args.Count;
323                         }
324                 }
325
326                 public TypeParameterName[] GetDeclarations ()
327                 {
328                         throw new NotImplementedException ();
329                 }
330                 
331                 public string GetSignatureForError ()
332                 {
333                         throw new NotImplementedException ();
334                 }
335
336                 public TypeArguments Clone ()
337                 {
338                         throw new NotImplementedException ();
339                 }
340         }
341
342         public class TypeInferenceContext
343         {
344                 public void ExactInference (Type u, Type v)
345                 {
346                         throw new NotImplementedException ();
347                 }
348                 
349                 public Type InflateGenericArgument (Type t)
350                 {
351                         throw new NotImplementedException ();           
352                 }
353         }
354 }