2008-11-05 Miguel de Icaza <miguel@novell.com>
[mono.git] / mcs / mcs / generic-mcs.cs
index afaf301b294b2696bf0321164bec1a70d6e0ba76..2505cba9993fa190bd090ce08e0bc6c8a91f449f 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //   Raja R Harinath <rharinath@novell.com>
 //
-// (C) 2006 Novell, Inc.
+// Copyright 2006 Novell, Inc.
 //
 using System;
 using System.Reflection;
@@ -13,8 +13,21 @@ using System.Collections;
 
 namespace Mono.CSharp
 {
+       public enum SpecialConstraint
+       {
+               Constructor,
+               ReferenceType,
+               ValueType
+       }
+       
        public abstract class GenericConstraints
        {
+               public bool HasValueTypeConstraint {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
+                       
                public abstract string TypeParameter {
                        get;
                }
@@ -24,18 +37,28 @@ namespace Mono.CSharp
                }
        }
 
-       public abstract class Constraints : GenericConstraints
+       public class Constraints : GenericConstraints
        {
+               public Constraints (string name, ArrayList constraints, Location loc)
+               {
+               }
+               
                public Constraints Clone ()
                {
                        throw new NotImplementedException ();
                }
-
-               public abstract Location Location {
-                       get;
+               
+               public Location Location {
+                       get { return Location.Null; } 
                }
+               
+               public override string TypeParameter {
+                       get { throw new NotImplementedException (); }
+               }               
 
-               public abstract void VerifyClsCompliance ();
+               public void VerifyClsCompliance ()
+               {
+               }
        }
 
        public class TypeParameter : MemberCore, IMemberContainer
@@ -117,7 +140,7 @@ namespace Mono.CSharp
                // IMemberContainer
                //
 
-               Type IMemberContainer.Type {
+               public Type Type {
                        get { throw new NotImplementedException (); }
                }
 
@@ -152,14 +175,6 @@ namespace Mono.CSharp
 
        public class TypeParameterExpr : TypeExpr
        {
-               public override string Name {
-                       get { throw new NotImplementedException (); }
-               }
-
-               public override string FullName {
-                       get { throw new NotImplementedException (); }
-               }
-
                public TypeParameterExpr (TypeParameter type_parameter, Location loc)
                {
                        throw new NotImplementedException ();
@@ -169,6 +184,12 @@ namespace Mono.CSharp
                {
                        return null;
                }
+
+               public TypeParameter TypeParameter {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+               }
        }
 
        public class TypeParameterName : SimpleName
@@ -205,14 +226,6 @@ namespace Mono.CSharp
                        throw new NotImplementedException ();
                }
 
-               public override string Name {
-                       get { throw new NotImplementedException (); }
-               }
-
-               public override string FullName {
-                       get { throw new NotImplementedException (); }
-               }
-
                protected override TypeExpr DoResolveAsTypeStep (IResolveContext ec)
                {
                        throw new NotImplementedException ();
@@ -254,11 +267,6 @@ namespace Mono.CSharp
                        throw new NotImplementedException ();
                }
 
-               public override bool DefineMembers ()
-               {
-                       throw new NotImplementedException ();
-               }
-               
                internal static void Error_ParameterNameCollision (Location loc, string name, string collisionWith)
                {
                }
@@ -285,24 +293,37 @@ namespace Mono.CSharp
 
        public class TypeArguments
        {
+               public readonly Location Location;
+               ArrayList args;
+               //Type[] atypes;
+               int dimension;
+               //bool has_type_args;
+               //bool created;
+               
                public TypeArguments (Location loc)
                {
-                       throw new NotImplementedException ();
+                       args = new ArrayList ();
+                       this.Location = loc;
                }
-               
+
                public TypeArguments (Location loc, params Expression[] types)
                {
-                       throw new NotImplementedException ();
-               }               
+                       this.Location = loc;
+                       this.args = new ArrayList (types);
+               }
+               
+               public TypeArguments (int dimension, Location loc)
+               {
+                       this.dimension = dimension;
+                       this.Location = loc;
+               }
 
                public void Add (Expression type)
                {
-                       throw new NotImplementedException ();
                }
 
                public void Add (TypeArguments new_args)
                {
-                       throw new NotImplementedException ();
                }
 
                public bool Resolve (IResolveContext ec)
@@ -315,7 +336,12 @@ namespace Mono.CSharp
                }
 
                public int Count {
-                       get { throw new NotImplementedException (); }
+                       get {
+                               if (dimension > 0)
+                                       return dimension;
+                               else
+                                       return args.Count;
+                       }
                }
 
                public bool IsUnbound {