2 // generic.cs: Support classes for generics to reduce differences from GMCS
5 // Raja R Harinath <rharinath@novell.com>
7 // Copyright 2006 Novell, Inc.
10 using System.Reflection;
11 using System.Reflection.Emit;
12 using System.Collections;
23 public enum SpecialConstraint
30 public abstract class GenericTypeParameterBuilder : Type
34 public class InternalsVisibleToAttribute
36 public string AssemblyName;
39 class ConstraintChecker
41 public static bool CheckConstraints (EmitContext ec, MethodBase a, MethodBase b, Location loc)
43 throw new NotSupportedException ();
47 public abstract class GenericConstraints
49 public bool HasConstructorConstraint {
50 get { throw new NotImplementedException (); }
53 public bool HasValueTypeConstraint {
54 get { throw new NotImplementedException (); }
57 public bool HasClassConstraint {
58 get { throw new NotImplementedException (); }
61 public bool HasReferenceTypeConstraint {
62 get { throw new NotImplementedException (); }
65 public abstract string TypeParameter {
69 public bool IsReferenceType {
70 get { throw new NotSupportedException (); }
73 public bool IsValueType {
74 get { throw new NotSupportedException (); }
77 public Type[] InterfaceConstraints {
78 get { throw new NotSupportedException (); }
81 public Type ClassConstraint {
82 get { throw new NotSupportedException (); }
85 public Type EffectiveBaseClass {
86 get { throw new NotSupportedException (); }
90 public class Constraints : GenericConstraints
92 public Constraints (string name, ArrayList constraints, Location loc)
96 public Constraints Clone ()
98 throw new NotImplementedException ();
101 public Location Location {
102 get { return Location.Null; }
105 public override string TypeParameter {
106 get { throw new NotImplementedException (); }
109 public void VerifyClsCompliance ()
114 public class TypeParameter : MemberCore, IMemberContainer
116 public TypeParameter (DeclSpace parent, DeclSpace decl, string name,
117 Constraints constraints, Attributes attrs, Variance variance, Location loc)
118 : base (parent, new MemberName (name, loc), attrs)
120 throw new NotImplementedException ();
123 public static string GetSignatureForError (TypeParameter[] tp)
125 throw new NotImplementedException ();
128 public void ErrorInvalidVariance (MemberCore mc, Variance v)
136 public override bool Define ()
141 public void Define (Type t)
145 public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
147 throw new NotImplementedException ();
150 public override AttributeTargets AttributeTargets {
151 get { throw new NotImplementedException (); }
154 public override string[] ValidAttributeTargets {
156 return new string [] { "type parameter" };
160 public Constraints Constraints {
166 public override string DocCommentHeader {
167 get { throw new NotImplementedException (); }
170 public bool Resolve (DeclSpace ds)
172 throw new NotImplementedException ();
175 public bool DefineType (IResolveContext ec)
177 throw new NotImplementedException ();
180 public bool DefineType (IResolveContext ec, MethodBuilder builder,
181 MethodInfo implementing, bool is_override)
183 throw new NotImplementedException ();
186 public bool CheckDependencies ()
188 throw new NotImplementedException ();
191 public bool UpdateConstraints (IResolveContext ec, Constraints new_constraints)
193 throw new NotImplementedException ();
201 get { throw new NotImplementedException (); }
204 string IMemberContainer.Name {
205 get { throw new NotImplementedException (); }
208 public Variance Variance {
209 get { throw new NotImplementedException (); }
212 MemberCache IMemberContainer.BaseCache {
213 get { throw new NotImplementedException (); }
216 bool IMemberContainer.IsInterface {
217 get { throw new NotImplementedException (); }
220 MemberList IMemberContainer.GetMembers (MemberTypes mt, BindingFlags bf)
222 throw new NotImplementedException ();
225 public bool IsSubclassOf (Type t)
227 throw new NotImplementedException ();
230 public MemberList FindMembers (MemberTypes mt, BindingFlags bf,
231 MemberFilter filter, object criteria)
233 throw new NotImplementedException ();
236 public void SetConstraints (GenericTypeParameterBuilder type)
238 throw new NotImplementedException ();
242 public class TypeParameterExpr : TypeExpr
244 public TypeParameterExpr (TypeParameter type_parameter, Location loc)
246 throw new NotImplementedException ();
249 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
254 public TypeParameter TypeParameter {
256 throw new NotImplementedException ();
261 public class TypeParameterName : SimpleName
263 Attributes attributes;
266 public TypeParameterName (string name, Attributes attrs, Location loc)
267 : this (name, attrs, Variance.None, loc)
271 public TypeParameterName (string name, Attributes attrs, Variance variance, Location loc)
275 this.variance = variance;
278 public Attributes OptAttributes {
284 public Variance Variance {
291 public class GenericTypeExpr : TypeExpr
293 public GenericTypeExpr (DeclSpace t, Location l)
295 throw new NotImplementedException ();
298 public GenericTypeExpr (Type t, TypeArguments args, Location l)
300 throw new NotImplementedException ();
303 protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
305 throw new NotImplementedException ();
308 public bool CheckConstraints (IResolveContext ec)
310 throw new NotImplementedException ();
313 public TypeArguments TypeArguments {
314 get { throw new NotImplementedException (); }
317 public bool VerifyVariantTypeParameters (IResolveContext rc)
319 throw new NotImplementedException ();
323 public class GenericMethod : DeclSpace
325 public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
326 Expression return_type, ParametersCompiled parameters)
327 : base (ns, parent, name, null)
329 throw new NotImplementedException ();
332 public override TypeBuilder DefineType ()
334 throw new NotImplementedException ();
337 public override bool Define ()
339 throw new NotImplementedException ();
342 public bool DefineType (EmitContext ec, MethodBuilder mb,
343 MethodInfo implementing, bool is_override)
345 throw new NotImplementedException ();
348 public void EmitAttributes ()
350 throw new NotImplementedException ();
353 internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
357 public override MemberCache MemberCache {
358 get { throw new NotImplementedException (); }
361 public override AttributeTargets AttributeTargets {
363 return AttributeTargets.Method | AttributeTargets.ReturnValue;
367 public override string DocCommentHeader {
371 public new void VerifyClsCompliance ()
373 throw new NotImplementedException ();
377 public class TypeArguments
381 public TypeArguments ()
383 args = new ArrayList ();
386 public TypeArguments (params Expression[] types)
388 args = new ArrayList (types);
391 public void Add (Expression type)
395 public void Add (TypeArguments new_args)
399 public bool Resolve (IResolveContext ec)
401 throw new NotImplementedException ();
404 public Type[] Arguments {
405 get { throw new NotImplementedException (); }
414 public TypeParameterName[] GetDeclarations ()
416 throw new NotImplementedException ();
419 public string GetSignatureForError ()
421 throw new NotImplementedException ();
424 public TypeArguments Clone ()
426 throw new NotImplementedException ();
430 public class TypeInferenceContext
432 public void ExactInference (Type u, Type v)
434 throw new NotImplementedException ();
437 public Type InflateGenericArgument (Type t)
439 throw new NotImplementedException ();
443 partial class TypeManager
445 public static Variance CheckTypeVariance (Type type, Variance v, MemberCore mc)
450 public static bool IsVariantOf (Type a, Type b)