From d935996d8851cff38ae1e4c64a8ff91271cdea89 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 9 Sep 2015 11:41:50 +0200 Subject: [PATCH] [mono-api-html] Adding members to an interface is a breaking change, so show it in red. --- .../corcompare/mono-api-html/MemberComparer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs index 3c08fed184f..dee528ebc7a 100644 --- a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs +++ b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs @@ -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 ("

Added {0}:

", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine (State.Colorize ? "
" : "
");
+
+			bool isInterface = list.Count () > 0 && IsInInterface (list.First ());
+			Output.WriteLine (State.Colorize ? string.Format ("
", isInterface ? "red" : "green") : "
");
 		}
 
 		public override void Added (XElement target)
-- 
2.25.1