Author: toshok
Date: 2007-12-27 11:39:54 -0500 (Thu, 27 Dec 2007)
New Revision: 91951
Modified:
trunk/mono-tools/gui-compare/CecilMetadata.cs
trunk/mono-tools/gui-compare/ChangeLog
trunk/mono-tools/gui-compare/CompareContext.cs
Log:
* CecilMetadata.cs: factor out all the duplicate attribute list
handling code. also, make it deal with MonoTODO attributes.
* CompareContext.cs: fix progress message
Modified: trunk/mono-tools/gui-compare/CecilMetadata.cs
===================================================================
--- trunk/mono-tools/gui-compare/CecilMetadata.cs 2007-12-27 16:12:56 UTC
(rev 91950)
+++ trunk/mono-tools/gui-compare/CecilMetadata.cs 2007-12-27 16:39:54 UTC
(rev 91951)
@@ -18,7 +18,6 @@
List<CompNamed>
field_list,
List<CompNamed>
event_list)
{
- Console.WriteLine ("21Populating {0}.{1}",
fromDef.Namespace, fromDef.Name);
if (interface_list != null) {
foreach (TypeReference ifc in
fromDef.Interfaces) {
interface_list.Add (new CecilInterface
(ifc, true));
@@ -99,6 +98,25 @@
}
}
}
+
+ public static bool ShouldSkipAttribute (string name)
+ {
+ return (name == "MonoLimitationAttribute" ||
+ name == "MonoDocumentationNoteAttribute" ||
+ name == "MonoTODOAttribute" ||
+ name == "MonoExtensionAttribute" ||
+ name == "MonoNotSupportedAttribute" ||
+ name == "MonoInternalNoteAttribute");
+ }
+
+ public static List<CompNamed> GetCustomAttributes
(ICustomAttributeProvider provider)
+ {
+ List<CompNamed> rv = new List<CompNamed>();
+ foreach (CustomAttribute ca in
provider.CustomAttributes)
+ if (!ShouldSkipAttribute
(ca.Constructor.DeclaringType.Name))
+ rv.Add (new CecilAttribute (ca));
+ return rv;
+ }
}
public class CecilAssembly : CompAssembly {
@@ -123,7 +141,7 @@
if (t.IsSpecialName || t.IsRuntimeSpecialName)
continue;
- if (ShouldSkip (t.Name))
+ if (Utils.ShouldSkipAttribute (t.Name))
continue;
if (!namespaces.ContainsKey (t.Namespace))
@@ -143,17 +161,6 @@
return namespace_list;
}
- bool ShouldSkip (string name)
- {
- return (name == "MonoLimitationAttribute" ||
- name == "MonoDocumentationNoteAttribute" ||
- name == "MonoTODOAttribute" ||
- name == "MonoExtensionAttribute" ||
- name == "MonoNotSupportedAttribute" ||
- name == "MonoInternalNoteAttribute");
-
- }
-
List<CompNamed> namespace_list;
}
@@ -269,10 +276,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in
type_ref.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (type_ref);
}
TypeReference type_ref;
@@ -312,10 +316,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in
type_def.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (type_def);
}
TypeDefinition type_def;
@@ -390,10 +391,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in
type_def.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (type_def);
}
public override List<CompNamed> GetNestedClasses()
@@ -445,10 +443,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in
field_def.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (field_def);
}
FieldDefinition field_def;
@@ -463,10 +458,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in
method_def.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (method_def);
}
static string MasterinfoFormattedName (MethodDefinition
method_def)
@@ -499,10 +491,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in pd.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (pd);
}
public override List<CompNamed> GetMethods()
@@ -530,10 +519,7 @@
public override List<CompNamed> GetAttributes ()
{
- List<CompNamed> rv = new List<CompNamed>();
- foreach (CustomAttribute ca in ed.CustomAttributes)
- rv.Add (new CecilAttribute (ca));
- return rv;
+ return Utils.GetCustomAttributes (ed);
}
EventDefinition ed;
Modified: trunk/mono-tools/gui-compare/ChangeLog
===================================================================
--- trunk/mono-tools/gui-compare/ChangeLog 2007-12-27 16:12:56 UTC (rev
91950)
+++ trunk/mono-tools/gui-compare/ChangeLog 2007-12-27 16:39:54 UTC (rev
91951)
@@ -1,5 +1,11 @@
2007-12-27 Chris Toshok <[EMAIL PROTECTED]>
+ * CecilMetadata.cs: factor out all the duplicate attribute list handling
+ code. also, make it deal with MonoTODO attributes.
+ * CompareContext.cs: fix progress message
+
+2007-12-27 Chris Toshok <[EMAIL PROTECTED]>
+
* MainWindow.cs: add handling for the refresh button. also, remove the
counts of various things if the View menu has them disabled.
* gtk-gui/MainWindow.cs, gtk-gui/gui.stetic: add a refresh button to
re-run
Modified: trunk/mono-tools/gui-compare/CompareContext.cs
===================================================================
--- trunk/mono-tools/gui-compare/CompareContext.cs 2007-12-27 16:12:56 UTC
(rev 91950)
+++ trunk/mono-tools/gui-compare/CompareContext.cs 2007-12-27 16:39:54 UTC
(rev 91951)
@@ -134,7 +134,7 @@
int c = String.Compare (master_list[m].Name,
assembly_list[a].Name);
if (c == 0) {
- ProgressOnGuiThread (0.0, String.Format
("Comparing {0} {0}", master_list[m].Type, master_list[m].Name));
+ ProgressOnGuiThread (0.0, String.Format
("Comparing {0} {1}", master_list[m].Type, master_list[m].Name));
/* the names match, further
investigation is required */
// Console.WriteLine ("{0} {1} is in both,
doing more comparisons", master_list[m].Type, master_list[m].Name);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches