2
0
Эх сурвалжийг харах

2005-01-18 Zoltan Varga <[email protected]>

	* MethodBase.cs MonoMethod.cs: Implement 2.0 GetMethodBody ().

svn path=/trunk/mcs/; revision=39110
Zoltan Varga 21 жил өмнө
parent
commit
90a4f0719d

+ 4 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,7 @@
+2005-01-18  Zoltan Varga  <[email protected]>
+
+	* MethodBase.cs MonoMethod.cs: Implement 2.0 GetMethodBody ().
+
 2005-01-03  Martin Baulig  <[email protected]>
 
 	* MonoGenericMethod.cs

+ 15 - 0
mcs/class/corlib/System.Reflection/MethodBase.cs

@@ -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
 	}
 }

+ 8 - 0
mcs/class/corlib/System.Reflection/MonoMethod.cs

@@ -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 () {