Browse Source

Thu Dec 19 16:43:19 CET 2002 Paolo Molaro <[email protected]>

	* MonoMethod.cs, ParameterInfo.cs: return a custom attribute
	provider for the return type of a method.

svn path=/trunk/mcs/; revision=9769
Paolo Molaro 23 years ago
parent
commit
fe58460445

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

@@ -1,3 +1,9 @@
+
+Thu Dec 19 16:43:19 CET 2002 Paolo Molaro <[email protected]>
+
+	* MonoMethod.cs, ParameterInfo.cs: return a custom attribute
+	provider for the return type of a method.
+
 2002-12-08  Gonzalo Paniagua Javier <[email protected]>
 
 	* AssemblyName.cs: little fix in FullName.

+ 9 - 7
mcs/class/corlib/System.Reflection/MonoMethod.cs

@@ -21,10 +21,10 @@ namespace System.Reflection {
 		internal MethodImplAttributes iattrs;
 
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
-		internal static extern void get_method_info (RuntimeMethodHandle handle, out MonoMethodInfo info);
+		internal static extern void get_method_info (IntPtr handle, out MonoMethodInfo info);
 		
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
-		internal static extern ParameterInfo[] get_parameter_info (RuntimeMethodHandle handle);
+		internal static extern ParameterInfo[] get_parameter_info (IntPtr handle);
 	};
 	
 	/*
@@ -32,7 +32,7 @@ namespace System.Reflection {
 	 * the .NET reflection class hierarchy is so broken.
 	 */
 	internal class MonoMethod : MethodInfo {
-		internal RuntimeMethodHandle mhandle;
+		internal IntPtr mhandle;
 		string name;
 		Type reftype;
 		
@@ -48,7 +48,9 @@ namespace System.Reflection {
 			}
 		}
 		public override ICustomAttributeProvider ReturnTypeCustomAttributes { 
-			get {return null;}
+			get {
+				return new ParameterInfo (ReturnType, this);
+			}
 		}
 		
 		public override MethodImplAttributes GetMethodImplementationFlags() {
@@ -82,7 +84,7 @@ namespace System.Reflection {
 		}
 
 		public override RuntimeMethodHandle MethodHandle { 
-			get {return mhandle;} 
+			get {return new RuntimeMethodHandle (mhandle);} 
 		}
 		public override MethodAttributes Attributes { 
 			get {
@@ -134,7 +136,7 @@ namespace System.Reflection {
 	}
 	
 	internal class MonoCMethod : ConstructorInfo {
-		internal RuntimeMethodHandle mhandle;
+		internal IntPtr mhandle;
 		string name;
 		Type reftype;
 		
@@ -173,7 +175,7 @@ namespace System.Reflection {
 		}
 
 		public override RuntimeMethodHandle MethodHandle { 
-			get {return mhandle;} 
+			get {return new RuntimeMethodHandle (mhandle);} 
 		}
 		public override MethodAttributes Attributes { 
 			get {

+ 9 - 0
mcs/class/corlib/System.Reflection/ParameterInfo.cs

@@ -28,6 +28,15 @@ namespace System.Reflection
 			this.PositionImpl = pb.Position;
 			this.AttrsImpl = (ParameterAttributes) pb.Attributes;
 		}
+	
+		/* to build a ParameterInfo for the return type of a method */
+		internal ParameterInfo (Type type, MemberInfo member) {
+			this.ClassImpl = type;
+			this.MemberImpl = member;
+			this.NameImpl = "";
+			this.PositionImpl = 0;
+			this.AttrsImpl = ParameterAttributes.Retval;
+		}
 		
 		public virtual Type ParameterType {
 			get {return ClassImpl;}

+ 4 - 0
mcs/class/corlib/System/RuntimeMethodHandle.cs

@@ -17,6 +17,10 @@ namespace System {
 	[Serializable]
 	public struct RuntimeMethodHandle : ISerializable {
 		IntPtr value;
+
+		internal RuntimeMethodHandle (IntPtr v) {
+			value = v;
+		}
 		
 		public IntPtr Value {
 			get {