[mono-api-info] Sort nested types.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 8 Sep 2015 11:53:47 +0000 (13:53 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 8 Sep 2015 11:55:10 +0000 (13:55 +0200)
So that info files can be compared textually to test for api equality.

mcs/tools/corcompare/mono-api-info.cs

index 8c5731eb73b2eba48465a7ac2d15ab0c2bddb43c..4bb6b96c5e3b83f1fc64b7d75850857ebbf025bd 100644 (file)
@@ -228,7 +228,7 @@ namespace CorCompare
                        var typesCollection = ass.MainModule.Types;
                        if (typesCollection == null || typesCollection.Count == 0)
                                return;
-                       object [] typesArray = new object [typesCollection.Count];
+                       var typesArray = new TypeDefinition [typesCollection.Count];
                        for (int i = 0; i < typesCollection.Count; i++) {
                                typesArray [i] = typesCollection [i];
                        }
@@ -487,11 +487,13 @@ namespace CorCompare
                                nested.RemoveAt (i);
                        }
 
-
                        if (nested.Count > 0) {
+                               var nestedArray = nested.ToArray ();
+                               Array.Sort (nestedArray, TypeReferenceComparer.Default);
+
                                XmlNode classes = document.CreateElement ("classes", null);
                                nclass.AppendChild (classes);
-                               foreach (TypeDefinition t in nested) {
+                               foreach (TypeDefinition t in nestedArray) {
                                        TypeData td = new TypeData (document, classes, t);
                                        td.DoOutput ();
                                }