[mono/mono] 24169a08: [mono-api-html] Output nested type correctly (was missing the declaring type name)

"Sebastien Pouliot ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141a80dea80-2d88458a-60fc-469f-a067-5fe5902e8e8d-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/d2b121244a06...24169a083ec5

   Commit: 24169a083ec528478244880c5b11550bb4197657
   Author: Sebastien Pouliot <[email protected]> (spouliot)
     Date: 2013-10-11 15:05:17 GMT
      URL: https://github.com/mono/mono/commit/24169a083ec528478244880c5b11550bb4197657

[mono-api-html] Output nested type correctly (was missing the declaring type name)

Changed paths:
  M mcs/tools/corcompare/mono-api-html/ClassComparer.cs

Modified: mcs/tools/corcompare/mono-api-html/ClassComparer.cs
===================================================================
@@ -183,7 +183,7 @@ public void AddedInner (XElement target)
 			if (t != null) {
 				Output.WriteLine ();
 				Indent ().WriteLine ("\t// inner types");
-				kcomparer = new ClassComparer ();
+				kcomparer = new NestedClassComparer ();
 				State.Indent++;
 				foreach (var inner in t.Elements ("class"))
 					kcomparer.AddedInner (inner);
@@ -208,21 +208,38 @@ public override void Modified (XElement source, XElement target)
 			var si = source.Element ("classes");
 			if (si != null) {
 				var ti = target.Element ("classes");
-				kcomparer = new ClassComparer ();
+				kcomparer = new NestedClassComparer ();
 				kcomparer.Compare (si.Elements ("class"), ti == null ? null : ti.Elements ("class"));
 			}
 
 			var s = (Output as StringWriter).ToString ();
 			State.Output = output;
 			if (s.Length > 0) {
-				Output.WriteLine ("<h3>Type Changed: {0}.{1}</h3>", State.Namespace, target.Attribute ("name").Value);
+				Output.WriteLine ("<h3>Type Changed: {0}.{1}</h3>", State.Namespace, GetTypeName (target));
 				Output.WriteLine (s);
 			}
 		}
 
 		public override void Removed (XElement source)
 		{
-			Output.WriteLine ("<h3>Removed Type {0}.{1}", State.Namespace, source.Attribute ("name").Value);
+			Output.WriteLine ("<h3>Removed Type {0}.{1}", State.Namespace, GetTypeName (source));
+		}
+
+		public virtual string GetTypeName (XElement type)
+		{
+			return type.GetAttribute ("name");
+		}
+	}
+
+	public class NestedClassComparer : ClassComparer {
+
+		public override void SetContext (XElement current)
+		{
+		}
+
+		public override string GetTypeName (XElement type)
+		{
+			return State.Type + "." + base.GetTypeName (type);
 		}
 	}
 }
\ No newline at end of file


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.