Forráskód Böngészése

* ICustomAttributeProvider.cs, IReflect.cs, MemberInfo.cs, AssemblyName.cs:
Removed completed TODOs.
* MonoProperty.cs: In GetAccessors(), GetGetMethod() and GetSetMethod(),
do not return private methods if nonPublic == false.
* ReflectionTypeLoadException.cs: Implemented serialization support.

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

Lluis Sanchez 22 éve
szülő
commit
4e06ac2b42

+ 1 - 3
mcs/class/corlib/System.Reflection/AssemblyName.cs

@@ -85,7 +85,6 @@ namespace System.Reflection {
 			set { flags = value; }
 		}
 
-		[MonoTODO("incomplete")]
 		public string FullName {
 			get {
 				if (name == null)
@@ -98,7 +97,7 @@ namespace System.Reflection {
 				if ((cultureinfo == null) || (cultureinfo.LCID == CultureInfo.InvariantCulture.LCID))
 					fname.Append ("neutral");
 				else
-					fname.Append (cultureinfo.ToString ()); // ???
+					fname.Append (cultureinfo.Name);
 				byte[] pub_tok = GetPublicKeyToken ();
 				if (pub_tok == null || pub_tok.Length == 0)
 					fname.Append (", PublicKeyToken=null");
@@ -107,7 +106,6 @@ namespace System.Reflection {
 					for (int i = 0; i < pub_tok.Length; i++)
 						fname.Append (pub_tok[i].ToString ("x2"));
 				}
-				// TODO
 				return fname.ToString ();
 			}
 		}

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

@@ -1,3 +1,11 @@
+2004-04-27  Lluis Sanchez Gual  <[email protected]>
+
+	* ICustomAttributeProvider.cs, IReflect.cs, MemberInfo.cs, AssemblyName.cs: 
+	  Removed completed	TODOs.
+	* MonoProperty.cs: In GetAccessors(), GetGetMethod() and GetSetMethod(),
+	  do not return private methods if nonPublic == false.
+	* ReflectionTypeLoadException.cs: Implemented serialization support.
+
 2004-04-26  Jackson Harper  <[email protected]>
 
 	* Assembly.cs: Add icall to determine if an assembly has been

+ 0 - 2
mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs

@@ -6,8 +6,6 @@
 //
 // (C) Ximian, Inc.  http://www.ximian.com
 //
-// TODO: Mucho left to implement.
-//
 
 namespace System.Reflection {
 

+ 0 - 2
mcs/class/corlib/System.Reflection/IReflect.cs

@@ -6,8 +6,6 @@
 //
 // (C) Ximian, Inc.  http://www.ximian.com
 //
-// TODO: Mucho left to implement.
-//
 
 using System;
 using System.Globalization;

+ 0 - 2
mcs/class/corlib/System.Reflection/MemberInfo.cs

@@ -6,8 +6,6 @@
 //
 // (C) Ximian, Inc.  http://www.ximian.com
 //
-// TODO: Mucho left to implement.
-//
 
 using System.Runtime.InteropServices;
 

+ 20 - 16
mcs/class/corlib/System.Reflection/MonoProperty.cs

@@ -105,33 +105,35 @@ namespace System.Reflection {
 			}
 		}
 
-		[MonoTODO]
 		public override MethodInfo[] GetAccessors (bool nonPublic)
 		{
-			// FIXME: check nonPublic
 			MonoPropertyInfo info;
-			int n = 0;
+			int nget = 0;
+			int nset = 0;
+			
 			MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod | PInfo.SetMethod);
-			if (info.set_method != null)
-				n++;
-			if (info.get_method != null)
-				n++;
-			MethodInfo[] res = new MethodInfo [n];
-			n = 0;
-			if (info.set_method != null)
+			if (info.set_method != null && (nonPublic || info.set_method.IsPublic))
+				nget = 1;
+			if (info.get_method != null && (nonPublic || info.get_method.IsPublic))
+				nset = 1;
+
+			MethodInfo[] res = new MethodInfo [nget + nset];
+			int n = 0;
+			if (nset != 0)
 				res [n++] = info.set_method;
-			if (info.get_method != null)
+			if (nget != 0)
 				res [n++] = info.get_method;
 			return res;
 		}
 
-		[MonoTODO]
 		public override MethodInfo GetGetMethod (bool nonPublic)
 		{
-			// FIXME: check nonPublic
 			MonoPropertyInfo info;
 			MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod);
-			return info.get_method;
+			if (info.get_method != null && (nonPublic || info.get_method.IsPublic))
+				return info.get_method;
+			else
+				return null;
 		}
 
 		public override ParameterInfo[] GetIndexParameters()
@@ -145,10 +147,12 @@ namespace System.Reflection {
 		
 		public override MethodInfo GetSetMethod (bool nonPublic)
 		{
-			// FIXME: check nonPublic
 			MonoPropertyInfo info;
 			MonoPropertyInfo.get_property_info (this, out info, PInfo.SetMethod);
-			return info.set_method;
+			if (info.set_method != null && (nonPublic || info.set_method.IsPublic))
+				return info.set_method;
+			else
+				return null;
 		}
 		
 		public override bool IsDefined (Type attributeType, bool inherit)

+ 8 - 9
mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs

@@ -33,6 +33,12 @@ namespace System.Reflection
 			types = classes;
 		}
 			
+		private ReflectionTypeLoadException (SerializationInfo info, StreamingContext sc): base (info, sc)
+		{
+			types = (Type[]) info.GetValue ("Types", typeof (Type[]));
+			loaderExceptions = (Exception[]) info.GetValue ("Exceptions", typeof (Exception[]));
+		}
+		
 		// Properties
 		public Type[] Types
 		{
@@ -44,18 +50,11 @@ namespace System.Reflection
 			get { return loaderExceptions; }
 		}
 
-		// Method
-		[MonoTODO]
-		//
-		// This one is a bit tough because need to serialize two arrays.
-		// The serialization output comes out as
-		// <Types href="#ref-4" /> 
-                // <Exceptions href="#ref-5" />
-		// and then goes on and appends new SOAP-ENCs, etc...
-		//
 		public override void GetObjectData (SerializationInfo info, StreamingContext context)
 		{
 			base.GetObjectData (info, context);
+			info.AddValue ("Types", types);
+			info.AddValue ("Exceptions", loaderExceptions);
 		}
 	
 	}