Procházet zdrojové kódy

2008-02-02 Rodrigo Kumpera <[email protected]>

	* MonoMethod.cs (ToString): Fix the representation of non primitive structs.

svn path=/trunk/mcs/; revision=125415
Rodrigo Kumpera před 17 roky
rodič
revize
f3ac092a88

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

@@ -1,3 +1,7 @@
+2008-02-02  Rodrigo Kumpera  <[email protected]>
+
+	* MonoMethod.cs (ToString): Fix the representation of non primitive structs.
+
 2008-02-02  Rodrigo Kumpera  <[email protected]>
 
 	* MonoMethod.cs (ToString): Fix representation of pointer types.

+ 5 - 2
mcs/class/corlib/System.Reflection/MonoMethod.cs

@@ -257,10 +257,13 @@ namespace System.Reflection {
 			return attrs;
 		}
 
+		static bool ShouldPrintFullName (Type type) {
+			return type.IsClass && (!type.IsPointer || (!type.GetElementType ().IsPrimitive && !type.GetElementType ().IsNested));
+		}
 		public override string ToString () {
 			StringBuilder sb = new StringBuilder ();
 			Type retType = ReturnType;
-			if (retType.IsClass  && !retType.IsPointer)
+			if (ShouldPrintFullName (retType))
 				sb.Append (retType.ToString ());
 			else
 				sb.Append (retType.Name);
@@ -287,7 +290,7 @@ namespace System.Reflection {
 				bool byref = pt.IsByRef;
 				if (byref)
 					pt = pt.GetElementType ();
-				if (pt.IsClass && !pt.IsPointer)
+				if (ShouldPrintFullName (pt))
 					sb.Append (pt.ToString ());
 				else
 					sb.Append (pt.Name);