2007-06-01 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 1 Jun 2007 13:52:22 +0000 (13:52 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 1 Jun 2007 13:52:22 +0000 (13:52 -0000)
* mono-api-info.cs mono-api-diff.cs :
  handle MonoTODOAttribute derivations.

svn path=/trunk/mcs/; revision=78406

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

index 436bf7e3e8a8f792c98279e0cca8c5cb29f83ec2..b6a2a4029099953ee94c77d02beb5d243e3d0a37 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-01  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * mono-api-info.cs mono-api-diff.cs :
+         handle MonoTODOAttribute derivations.
+
 2007-04-17  Alp Toker  <alp@atoker.com>
 
        * mono-api-diff.cs:
index e86d6557192fe29b5f8065ab3ae1458b0c6f53e0..90144ff70d95c5026d7f02600c40b89aaae73430 100644 (file)
@@ -178,6 +178,20 @@ namespace Mono.AssemblyCompare
                        return (object []) list.ToArray (type);
                }
 
+               public static bool IsMonoTODOAttribute (string s)
+               {
+                       if (s == null)
+                               return false;
+                       if (//s.EndsWith ("MonoTODOAttribute") ||
+                           s.EndsWith ("MonoDocumentationNoteAttribute") ||
+                           s.EndsWith ("MonoExtensionAttribute") ||
+//                         s.EndsWith ("MonoInternalNoteAttribute") ||
+                           s.EndsWith ("MonoLimitationAttribute") ||
+                           s.EndsWith ("MonoNotSupportedAttribute"))
+                               return true;
+                       return s.EndsWith ("TODOAttribute");
+               }
+
                protected void AddAttribute (XmlNode node, string name, string value)
                {
                        XmlAttribute attr = document.CreateAttribute (name);
@@ -581,7 +595,7 @@ namespace Mono.AssemblyCompare
                                count = other.Length;
                                for (int i = 0; i < count; i++) {
                                        XMLClass c = other [i];
-                                       if (c == null || c.Name.EndsWith ("TODOAttribute"))
+                                       if (c == null || IsMonoTODOAttribute (c.Name))
                                                continue;
 
                                        node = document.CreateElement ("class", null);
@@ -872,7 +886,7 @@ namespace Mono.AssemblyCompare
                                count = other.Length;
                                for (int i = 0; i < count; i++) {
                                        XMLClass c = other [i];
-                                       if (c == null || c.Name.EndsWith ("TODOAttribute"))
+                                       if (c == null || IsMonoTODOAttribute (c.Name))
                                                continue;
 
                                        node = document.CreateElement ("nestedclass", null);
@@ -1095,11 +1109,11 @@ namespace Mono.AssemblyCompare
 
                protected override bool CheckIfAdd (string value, XmlNode node)
                {
-                       if (value.EndsWith ("TODOAttribute")) {
+                       if (IsMonoTODOAttribute (value)) {
                                isTodo = true;
 
                                XmlNode pNode = node.SelectSingleNode ("properties");
-                               if (pNode.ChildNodes [0].Attributes ["value"] != null) {
+                               if (pNode != null && pNode.ChildNodes.Count > 0 && pNode.ChildNodes [0].Attributes ["value"] != null) {
                                        comment = pNode.ChildNodes [0].Attributes ["value"].Value;
                                }
                                return false;
@@ -1166,7 +1180,7 @@ namespace Mono.AssemblyCompare
                {
                        XmlNode pNode = node.SelectSingleNode ("properties");
 
-                       if (name.EndsWith ("TODOAttribute")) {
+                       if (IsMonoTODOAttribute (name)) {
                                isTodo = true;
                                if (pNode.ChildNodes [0].Attributes ["value"] != null) {
                                        comment = pNode.ChildNodes [0].Attributes ["value"].Value;
index 52fab172d4aca2c23144978a7583e643588d7c18..37ac9e7b739269a3603eba739d0bf1f373189573 100644 (file)
@@ -120,6 +120,20 @@ namespace Mono.AssemblyInfo
                        attr.Value = value;
                        node.Attributes.Append (attr);
                }
+
+               public static bool IsMonoTODOAttribute (string s)
+               {
+                       if (s == null)
+                               return false;
+                       if (//s.EndsWith ("MonoTODOAttribute") ||
+                           s.EndsWith ("MonoDocumentationNoteAttribute") ||
+                           s.EndsWith ("MonoExtensionAttribute") ||
+//                         s.EndsWith ("MonoInternalNoteAttribute") ||
+                           s.EndsWith ("MonoLimitationAttribute") ||
+                           s.EndsWith ("MonoNotSupportedAttribute"))
+                               return true;
+                       return s.EndsWith ("TODOAttribute");
+               }
        }
 
        class AssemblyData : BaseData
@@ -901,7 +915,7 @@ namespace Mono.AssemblyInfo
 
                        for (int i = 0; i < atts.Length; ++i) {
                                Type t = atts [i].GetType ();
-                               if (!t.IsPublic && !t.Name.EndsWith ("TODOAttribute"))
+                               if (!t.IsPublic && !IsMonoTODOAttribute ("TODOAttribute"))
                                        continue;
 
                                // we ignore attributes that inherit from SecurityAttribute on purpose as they:
@@ -958,7 +972,7 @@ namespace Mono.AssemblyInfo
                private static bool MustDocumentAttribute (Type attributeType)
                {
                        // only document MonoTODOAttribute and public attributes
-                       return attributeType.Name.EndsWith ("TODOAttribute") || attributeType.IsPublic;
+                       return attributeType.IsPublic || IsMonoTODOAttribute (attributeType.Name);
                }
        }