Don't use runtime flag for basic compiler (it still lives in old world)
[mono.git] / mcs / class / corlib / System.Reflection / MethodInfo.cs
index 0624a0726abf78ce731f426650cffa361360f4c8..4b76a5d89cc22647a0db11a6ae62cb5e94214cd8 100644 (file)
@@ -33,40 +33,30 @@ using System.Runtime.InteropServices;
 
 namespace System.Reflection {
 
-#if NET_2_0
        [ComVisible (true)]
        [ComDefaultInterfaceAttribute (typeof (_MethodInfo))]
-#endif
        [Serializable]
        [ClassInterface(ClassInterfaceType.None)]
        public abstract class MethodInfo: MethodBase, _MethodInfo {
 
                public abstract MethodInfo GetBaseDefinition();
 
-               protected MethodInfo() {
+               internal virtual MethodInfo GetBaseMethod ()
+               {
+                       return this;
                }
 
-#if ONLY_1_1
-               public new Type GetType ()
-               {
-                       return base.GetType ();
+               protected MethodInfo() {
                }
-#endif
+
 
                public override MemberTypes MemberType { get {return MemberTypes.Method;} }
-               public abstract Type ReturnType { get; }
-               public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
 
-               // FIXME: when this method is uncommented, corlib fails
-               // to build
-/*
-               [DebuggerStepThrough]
-               [DebuggerHidden]
-               public new object Invoke (object obj, object[] parameters)
-               {
-                       return base.Invoke (obj, parameters);
+               public virtual Type ReturnType {
+                       get { return null; }
                }
-*/
+
+               public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
 
                void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
                {
@@ -88,22 +78,79 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-#if NET_2_0 || BOOTSTRAP_NET_2_0
+               [ComVisible (true)]
                public virtual MethodInfo GetGenericMethodDefinition ()
                {
                        throw new NotSupportedException ();
                }
 
-               public virtual MethodInfo MakeGenericMethod (params Type [] types)
+               public virtual MethodInfo MakeGenericMethod (params Type [] typeArguments)
                {
                        throw new NotSupportedException (this.GetType().ToString ());
                }
 
+               // GetGenericArguments, IsGenericMethod, IsGenericMethodDefinition
+               // and ContainsGenericParameters are implemented in the derived classes.
+               [ComVisible (true)]
+               public override Type [] GetGenericArguments () {
+                       return Type.EmptyTypes;
+               }
+
+#if !NET_4_0 && !MOONLIGHT
+               public override bool IsGenericMethod {
+                       get {
+                               return false;
+                       }
+               }
+
+               public override bool IsGenericMethodDefinition {
+                       get {
+                               return false;
+                       }
+               }
+
+               public override bool ContainsGenericParameters {
+                       get {
+                               return false;
+                       }
+               }
+#endif
+
                public virtual ParameterInfo ReturnParameter {
                        get {
                                throw new NotSupportedException ();
                        }
                }
+
+#if NET_4_0
+               public override bool Equals (object obj)
+               {
+                       return obj == (object) this;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return base.GetHashCode ();
+               }
+
+               public static bool operator == (MethodInfo left, MethodInfo right)
+               {
+                       if ((object)left == (object)right)
+                               return true;
+                       if ((object)left == null ^ (object)right == null)
+                               return false;
+                       return left.Equals (right);
+               }
+
+               public static bool operator != (MethodInfo left, MethodInfo right)
+               {
+                       if ((object)left == (object)right)
+                               return false;
+                       if ((object)left == null ^ (object)right == null)
+                               return true;
+                       return !left.Equals (right);
+               }
 #endif
+
        }
 }