Fri Aug 1 16:47:17 CEST 2003 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Fri, 1 Aug 2003 14:59:42 +0000 (14:59 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Fri, 1 Aug 2003 14:59:42 +0000 (14:59 -0000)
* Type.cs, MonoType.cs: implemented generic-specific methods.

svn path=/trunk/mcs/; revision=16991

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/MonoType.cs
mcs/class/corlib/System/Type.cs

index ee42cb870af9c27f7b617b1f23cb502b8bd212bd..560606d0a3eb7b130859f559af975b4dee142211 100644 (file)
@@ -1,3 +1,8 @@
+
+Fri Aug 1 16:47:17 CEST 2003 Paolo Molaro <lupus@ximian.com>
+
+       * Type.cs, MonoType.cs: implemented generic-specific methods.
+
 2003-07-29  Miguel de Icaza  <miguel@ximian.com>
 
        * Buffer.cs: Add new internal MemCopy call.
index de144a6790a513a44dda8b6a7e218ac7a3e4a9f9..d877bde7646ed31a9e0d4c6adf1555b88438387e 100644 (file)
@@ -539,29 +539,21 @@ namespace System
                }
 
 #if GENERICS
-               public override bool HasGenericParameters {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public extern override bool HasGenericParameters {
+                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
+                       get;
                }
 
-               public override bool HasUnboundGenericParameters {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public extern override bool HasUnboundGenericParameters {
+                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
+                       get;
                }
 
-               public override bool IsUnboundGenericParameter {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public extern override bool IsUnboundGenericParameter {
+                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
+                       get;
                }
 
-               public override int GenericParameterPosition {
-                       get {
-                               throw new Exception ("Unimplemented");
-                       }
-               }
 #endif
        }
 }
index bf47faeb8ae3c48f332cba430aa03e6767fa6dfe..3155ebab74ca401a4a8b4722fb2f8d3305f5c197 100644 (file)
@@ -930,13 +930,8 @@ namespace System {
                }
 
 #if GENERICS
-               public Type [] GetGenericParameters ()
-               {
-                       if (HasGenericParameters == false)
-                               return new Type [0];
-
-                       throw new Exception ("Unimplemented");
-               }
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern Type [] GetGenericParameters ();
 
                public abstract bool HasGenericParameters {
                        get;
@@ -946,28 +941,50 @@ namespace System {
                        get;
                }
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               static extern Type GetGenericTypeDefinition (Type t);
+
                public Type GetGenericTypeDefinition ()
                {
-                       throw new Exception ("Unimplemented");
+                       Type res = GetGenericTypeDefinition (this);
+                       if (res == null)
+                               throw new ArgumentException ();
+                       return res;
                }
 
-               public Type IsGenericTypeDefinition ()
-               {
-                       throw new Exception ("Unimplemented");
-               }
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern Type IsGenericTypeDefinition ();
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               static extern Type BindGenericParameters (Type gt, Type [] types);
+               
                public Type BindGenericParameters (Type [] types)
                {
-                       throw new Exception ("Unimplemented");
+                       if (types == null)
+                               throw new ArgumentNullException ("types");
+                       foreach (Type t in types) {
+                               if (t == null)
+                                       throw new ArgumentNullException ("types");
+                       }
+                       Type res = BindGenericParameters (this, types);
+                       if (res == null)
+                               throw new TypeLoadException ();
+                       return res;
                }
 
                public abstract bool IsUnboundGenericParameter {
                        get;
                }
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               extern int GetGenericParameterPosition ();
+               
                public virtual int GenericParameterPosition {
                        get {
-                               throw new Exception ("Unimplemented");
+                               int res = GetGenericParameterPosition ();
+                               if (res < 0)
+                                       throw new ArgumentException ();
+                               return res;
                        }
                }
 #endif