提交 3bc96e9c 编写于 作者: R Rolf Bjarne Kvinge

[mono-api-html] New interface members are only breaking if the interface existed.

上级 4d1c0d51
......@@ -57,7 +57,7 @@ namespace Xamarin.ApiDiff {
State.Assembly = current.GetAttribute ("name");
}
public override void Added (XElement target)
public override void Added (XElement target, bool wasParentAdded)
{
// one assembly per xml file
}
......
......@@ -67,7 +67,7 @@ namespace Xamarin.ApiDiff {
Compare (s.Elements ("class"), t.Elements ("class"));
}
public override void Added (XElement target)
public override void Added (XElement target, bool wasParentAdded)
{
string name = target.Attribute ("name").Value;
if (State.IgnoreNew.Any (re => re.IsMatch (name)))
......@@ -151,7 +151,7 @@ namespace Xamarin.ApiDiff {
if (t != null) {
Indent ().WriteLine ("\t// constructors");
foreach (var ctor in t.Elements ("constructor"))
ccomparer.Added (ctor);
ccomparer.Added (ctor, true);
}
t = target.Element ("fields");
......@@ -161,28 +161,28 @@ namespace Xamarin.ApiDiff {
else
SetContext (target);
foreach (var field in t.Elements ("field"))
fcomparer.Added (field);
fcomparer.Added (field, true);
}
t = target.Element ("properties");
if (t != null) {
Indent ().WriteLine ("\t// properties");
foreach (var property in t.Elements ("property"))
pcomparer.Added (property);
pcomparer.Added (property, true);
}
t = target.Element ("events");
if (t != null) {
Indent ().WriteLine ("\t// events");
foreach (var evnt in t.Elements ("event"))
ecomparer.Added (evnt);
ecomparer.Added (evnt, true);
}
t = target.Element ("methods");
if (t != null) {
Indent ().WriteLine ("\t// methods");
foreach (var method in t.Elements ("method"))
mcomparer.Added (method);
mcomparer.Added (method, true);
}
t = target.Element ("classes");
......
......@@ -48,7 +48,7 @@ namespace Xamarin.ApiDiff {
return State.Output;
}
public abstract void Added (XElement target);
public abstract void Added (XElement target, bool wasParentAdded);
public abstract void Modified (XElement source, XElement target, ApiChanges changes);
public abstract void Removed (XElement source);
......@@ -90,7 +90,7 @@ namespace Xamarin.ApiDiff {
if (target != null) {
foreach (var item in target) {
SetContext (item);
Added (item);
Added (item, false);
}
}
}
......
......@@ -129,7 +129,7 @@ namespace Xamarin.ApiDiff {
BeforeAdding (elements);
a = true;
}
Added (item);
Added (item, false);
}
if (a)
AfterAdding ();
......@@ -204,14 +204,14 @@ namespace Xamarin.ApiDiff {
Output.WriteLine ("<pre>");
}
public override void Added (XElement target)
public override void Added (XElement target, bool wasParentAdded)
{
var o = GetObsoleteMessage (target);
if (!first && (o.Length > 0))
Output.WriteLine ();
Indent ();
bool isInterface = IsInInterface (target);
Output.Write ("\t<span class='added added-{0} {1}' {2}>", ElementName, isInterface ? "breaking" : string.Empty, isInterface ? "data-is-breaking" : "data-is-non-breaking");
bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
Output.Write ("\t<span class='added added-{0} {1}' {2}>", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
Output.Write ("{0}{1}", o, GetDescription (target));
Output.WriteLine ("</span>");
first = false;
......
......@@ -55,7 +55,7 @@ namespace Xamarin.ApiDiff {
State.Namespace = current.Attribute ("name").Value;
}
public override void Added (XElement target)
public override void Added (XElement target, bool wasParentAdded)
{
string name = target.Attribute ("name").Value;
if (State.IgnoreNew.Any (re => re.IsMatch (name)))
......@@ -66,7 +66,7 @@ namespace Xamarin.ApiDiff {
Output.WriteLine ();
// list all new types
foreach (var addedType in target.Element ("classes").Elements ("class"))
comparer.Added (addedType);
comparer.Added (addedType, true);
Output.WriteLine ("</div> <!-- end namespace {0} -->", name);
Output.WriteLine ();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册