2005-01-18 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Tue, 18 Jan 2005 19:20:03 +0000 (19:20 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 18 Jan 2005 19:20:03 +0000 (19:20 -0000)
* MethodBase.cs MonoMethod.cs: Implement 2.0 GetMethodBody ().

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

mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/MethodBase.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs

index a0ca9b9fa791958f63b200aaf71a0595a9e3c07b..99f7ca8f8462e786dacacc3ee0ac1cdfeb39f167 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-18  Zoltan Varga  <vargaz@freemail.hu>
+
+       * MethodBase.cs MonoMethod.cs: Implement 2.0 GetMethodBody ().
+
 2005-01-03  Martin Baulig  <martin@ximian.com>
 
        * MonoGenericMethod.cs
index 0ddbe90922936c6d94947431d3f6dca41d4ac0eb..6052344e715639fe001c175ed1ca75e1724518ee 100644 (file)
@@ -202,6 +202,21 @@ namespace System.Reflection {
                                throw new NotSupportedException ();
                        }
                }
+
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               internal extern static MethodBody GetMethodBodyInternal (IntPtr handle);
+
+               internal static MethodBody GetMethodBody (IntPtr handle) {
+                       MethodBody mb = GetMethodBodyInternal (handle);
+                       if (mb == null)
+                               throw new ArgumentException ("Only methods with IL bodies are supported.");
+                       else
+                               return mb;
+               }                       
+
+               public virtual MethodBody GetMethodBody () {
+                       throw new NotSupportedException ();
+               }
 #endif
        }
 }
index 6513e4c2b3a295796e03895ea529e9c806e18604..7c2cd5d8b82ae0863c585da5819c54aed686959d 100755 (executable)
@@ -276,6 +276,10 @@ namespace System.Reflection {
                        [MethodImplAttribute(MethodImplOptions.InternalCall)]
                        get;
                }
+
+               public override MethodBody GetMethodBody () {
+                       return GetMethodBody (mhandle);
+               }
 #endif
        }
        
@@ -399,6 +403,10 @@ namespace System.Reflection {
                                return false;
                        }
                }
+
+               public override MethodBody GetMethodBody () {
+                       return GetMethodBody (mhandle);
+               }
 #endif
 
                public override string ToString () {