[sgen] Evacuate from emptier blocks to fuller ones
[mono.git] / mcs / tools / corcompare / mono-api-html / Comparer.cs
index 3cf678f7fffe4e28b26e1279ebc5d4ca6765999c..4210b9b95fbbd367742923889c93dd94d307c853 100644 (file)
@@ -35,7 +35,7 @@ namespace Xamarin.ApiDiff {
        public abstract class Comparer {
 
                protected List<XElement> removed = new List<XElement> ();
-               protected List<XElement> obsoleted = new List<XElement> ();
+               protected ApiChanges modified = new ApiChanges ();
 
                public TextWriter Output {
                        get { return State.Output; }
@@ -48,11 +48,11 @@ namespace Xamarin.ApiDiff {
                        return State.Output;
                }
 
-               public abstract void Added (XElement target);
-               public abstract void Modified (XElement source, 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);
 
-               public virtual bool Equals (XElement source, XElement target)
+               public virtual bool Equals (XElement source, XElement target, ApiChanges changes)
                {
                        return XNode.DeepEquals (source, target);
                }
@@ -62,6 +62,7 @@ namespace Xamarin.ApiDiff {
                public virtual void Compare (IEnumerable<XElement> source, IEnumerable<XElement> target)
                {
                        removed.Clear ();
+                       modified.Clear ();
 
                        foreach (var s in source) {
                                SetContext (s);
@@ -73,11 +74,11 @@ namespace Xamarin.ApiDiff {
                                } else {
                                        t.Remove ();
                                        // possibly modified
-                                       if (Equals (s, t))
+                                       if (Equals (s, t, modified))
                                                continue;
 
                                        // still in target so will be part of Added
-                                       Modified (s, t);
+                                       Modified (s, t, modified);
                                }
                        }
                        // delayed, that way we show "Modified", "Added" and then "Removed"
@@ -89,7 +90,7 @@ namespace Xamarin.ApiDiff {
                        if (target != null) {
                                foreach (var item in target) {
                                        SetContext (item);
-                                       Added (item);
+                                       Added (item, false);
                                }
                        }
                }