2004-03-29 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Tue, 30 Mar 2004 00:12:32 +0000 (00:12 -0000)
committerMartin Baulig <martin@novell.com>
Tue, 30 Mar 2004 00:12:32 +0000 (00:12 -0000)
* MethodBase.cs: Moved the generics stuff here, made it virtual
where neccessary and use the correct API.

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

mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/MethodBase.cs
mcs/class/corlib/System.Reflection/MethodInfo.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs

index cfa420a3a111680032f5f44a57260ba64c3338b6..225a7c266c737d3b977081b494a5181d651cefa2 100644 (file)
@@ -215,6 +215,14 @@ namespace System.Reflection.Emit {
                                throw not_after_created ();
                }
 
+#if NET_1_2
+               public override bool HasGenericParameters {
+                       get {
+                               return false;
+                       }
+               }
+#endif
+
                public override string ToString() {
                        return "constructor";
                }
index a8b7b0a238de9f2156e3e34226bf5e51b4a1d2ac..7a7be02b725678f919d3f1172b83a36f706af17b 100644 (file)
@@ -271,11 +271,6 @@ namespace System.Reflection.Emit {
                        return new NotSupportedException ("The invoked member is not supported on a dynamic method.");
                }
 
-               public override Type[] GetGenericArguments ()
-               {
-                       throw new NotImplementedException ();
-               }
-
                internal int AddRef (object reference) {
                        if (refs == null)
                                refs = new object [4];
index 63b9477decb8630a3472a6c90135cdd30b5d86be..931aa0e8508cfb9f1a511cc6b96fd8ed2be89902 100755 (executable)
@@ -304,6 +304,9 @@ namespace System.Reflection.Emit {
                }
 
 #if NET_1_2
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public override extern MethodInfo BindGenericParameters (Type [] types);
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern MonoGenericParam define_generic_parameter (string name, int index);
                
@@ -329,7 +332,13 @@ namespace System.Reflection.Emit {
                        generic_params [index].SetConstraints (constraints);
                }
 
-               public override Type[] GetGenericArguments ()
+               public override bool HasGenericParameters {
+                       get {
+                               return generic_params != null;
+                       }
+               }
+
+               public override Type[] GetGenericParameters ()
                {
                        if (generic_params == null)
                                return new Type [0];
index a94a2d1752e3a9ba5eed29852950b5cc18de1c1d..130cd3e5623d098663f8c3bcb9698ee55b5372d7 100755 (executable)
@@ -107,12 +107,5 @@ namespace System.Reflection {
                        }
                        return ReturnType.Name+" "+Name+"("+parms+")";
                }
-
-#if NET_1_2
-               public override Type[] GetGenericArguments ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
        }
 }
index c8a449db6b13ef8a35d39f973cf86e14d57bbd48..cb7911a8b933281e9e132095c91b5c1aef89cec2 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-29  Martin Baulig  <martin@ximian.com>
+
+       * MethodBase.cs: Moved the generics stuff here, made it virtual
+       where neccessary and use the correct API.
+
 2004-03-24  Sebastien Pouliot  <sebastien@ximian.com>
 
        * StrongNameKeyPair.cs: Added an internal method to return a 
index 539d697021bf6b76519c582adcda76acb59e7e25..b713a50fdc8212396aee57ff57aa828870951754 100644 (file)
@@ -142,21 +142,31 @@ namespace System.Reflection {
                }
 
 #if NET_1_2
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern MethodInfo GetGenericMethodDefinition_impl ();
+               public virtual MethodInfo BindGenericParameters (Type [] types)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public virtual Type [] GetGenericParameters ()
+               {
+                       throw new NotSupportedException ();
+               }
 
                public virtual MethodInfo GetGenericMethodDefinition ()
                {
-                       MethodInfo res = GetGenericMethodDefinition_impl ();
-                       if (res == null)
-                               throw new InvalidOperationException ();
+                       throw new NotSupportedException ();
+               }
 
-                       return res;
+               public virtual bool HasGenericParameters {
+                       get {
+                               throw new NotSupportedException ();
+                       }
                }
 
-               public extern bool HasGenericParameters {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
+               public virtual bool IsGenericMethodDefinition {
+                       get {
+                               throw new NotSupportedException ();
+                       }
                }
 #endif
        }
index e1c0087b343d9c2ba3c9f72cfe6bb786fc666cfb..17388d2a57d612797b601c49690ffc1916bba2e0 100644 (file)
@@ -24,18 +24,6 @@ namespace System.Reflection {
                public override MemberTypes MemberType { get {return MemberTypes.Method;} }
                public abstract Type ReturnType { get; }
                public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; } 
-
-#if NET_1_2
-               public extern bool IsGenericMethodDefinition {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
-
-               public abstract Type [] GetGenericArguments ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern MethodInfo BindGenericParameters (Type [] types);
-#endif
        }
 
 }
index b06c4b2154afa394e3d225f88114d54be68a7ca8..e6b94b23f3d4b55692c88aef4d407eced75bbd42 100755 (executable)
@@ -176,7 +176,32 @@ namespace System.Reflection {
 
 #if NET_1_2
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public override extern Type [] GetGenericArguments ();
+               public override extern MethodInfo BindGenericParameters (Type [] types);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public override extern Type [] GetGenericParameters ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               extern MethodInfo GetGenericMethodDefinition_impl ();
+
+               public override MethodInfo GetGenericMethodDefinition ()
+               {
+                       MethodInfo res = GetGenericMethodDefinition_impl ();
+                       if (res == null)
+                               throw new InvalidOperationException ();
+
+                       return res;
+               }
+
+               public override extern bool HasGenericParameters {
+                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
+                       get;
+               }
+
+               public override extern bool IsGenericMethodDefinition {
+                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
+                       get;
+               }
 #endif
        }
        
@@ -271,6 +296,20 @@ namespace System.Reflection {
                        return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
                }
 
+#if NET_1_2
+               public override bool HasGenericParameters {
+                       get {
+                               return false;
+                       }
+               }
+
+               public override bool IsGenericMethodDefinition {
+                       get {
+                               return false;
+                       }
+               }
+#endif
+
                public override string ToString () {
                        string parms = "";
                        ParameterInfo[] p = GetParameters ();