[mono-api-html] Adding members to an interface is a breaking change, so show it in...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 9 Sep 2015 09:41:50 +0000 (11:41 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 9 Sep 2015 09:42:22 +0000 (11:42 +0200)
mcs/tools/corcompare/mono-api-html/MemberComparer.cs

index 3c08fed184f5741af2b08c8a388256406d6ac108..dee528ebc7a6966e7b1472855f14d5917298ca25 100644 (file)
@@ -61,6 +61,16 @@ namespace Xamarin.ApiDiff {
                {
                }
 
+               string GetContainingType (XElement el)
+               {
+                       return el.Ancestors ("class").First ().Attribute ("type").Value;
+               }
+
+               bool IsInInterface (XElement el)
+               {
+                       return GetContainingType (el) == "interface";
+               }
+
                public XElement Source { get; set; }
 
                public virtual bool Find (XElement e)
@@ -183,7 +193,9 @@ namespace Xamarin.ApiDiff {
                {
                        first = true;
                        Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName);
-                       Output.WriteLine (State.Colorize ? "<pre style='color: green'>" : "<pre>");
+
+                       bool isInterface = list.Count () > 0 && IsInInterface (list.First ());
+                       Output.WriteLine (State.Colorize ? string.Format ("<pre style='color: {0}'>", isInterface ? "red" : "green") : "<pre>");
                }
 
                public override void Added (XElement target)