Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJb Evain <jbevain@gmail.com>2008-12-17 18:57:01 +0300
committerJb Evain <jbevain@gmail.com>2008-12-17 18:57:01 +0300
commit90522209817e107b570c9acdc02da4536e1dfdbc (patch)
treeb86174f619b5e229c6c6dc2793394ce6b8b13c22 /gui-compare
parent6a9800cd21f5f8d38059fc4cf04399db36a443f8 (diff)
2008-12-17 Jb Evain <jbevain@novell.com>
* CecilMetadata.cs: in the process of fixing our interface story. Always include all the interfaces for a type, by walking down its hierarchy. mono-api-info does the same as well now. This make it easier to compare interface implementation. svn path=/trunk/mono-tools/; revision=121694
Diffstat (limited to 'gui-compare')
-rw-r--r--gui-compare/CecilMetadata.cs33
-rw-r--r--gui-compare/ChangeLog7
2 files changed, 39 insertions, 1 deletions
diff --git a/gui-compare/CecilMetadata.cs b/gui-compare/CecilMetadata.cs
index e0d3e7eb..9ae92100 100644
--- a/gui-compare/CecilMetadata.cs
+++ b/gui-compare/CecilMetadata.cs
@@ -117,10 +117,11 @@ namespace GuiCompare {
List<CompNamed> event_list)
{
if (interface_list != null) {
- foreach (TypeReference ifc in fromDef.Interfaces) {
+ foreach (TypeReference ifc in GetInterfaces (fromDef)) {
TypeDefinition ifc_def = CecilUtils.Resolver.Resolve (ifc);
if (ifc_def.IsNotPublic)
continue;
+
interface_list.Add (new CecilInterface (ifc));
}
}
@@ -185,6 +186,36 @@ namespace GuiCompare {
}
}
+ static TypeDefinition Resolve (TypeReference type)
+ {
+ return CecilUtils.Resolver.Resolve (type);
+ }
+
+ static IEnumerable<TypeDefinition> WalkHierarchy (TypeReference type)
+ {
+ for (var definition = Resolve (type); definition != null; definition = GetBaseType (definition))
+ yield return definition;
+ }
+
+ static TypeDefinition GetBaseType (TypeDefinition type)
+ {
+ if (type.BaseType == null)
+ return null;
+
+ return Resolve (type.BaseType);
+ }
+
+ static IEnumerable<TypeReference> GetInterfaces (TypeReference type)
+ {
+ var cache = new Dictionary<string, TypeReference> ();
+
+ foreach (var definition in WalkHierarchy (type))
+ foreach (TypeReference iface in definition.Interfaces)
+ cache [iface.FullName] = iface;
+
+ return cache.Values;
+ }
+
static bool IsFinalizer (MethodDefinition method)
{
if (method.Name != "Finalize")
diff --git a/gui-compare/ChangeLog b/gui-compare/ChangeLog
index a85ffe98..35e867d4 100644
--- a/gui-compare/ChangeLog
+++ b/gui-compare/ChangeLog
@@ -1,5 +1,12 @@
2008-12-17 Jb Evain <jbevain@novell.com>
+ * CecilMetadata.cs: in the process of fixing our interface story.
+ Always include all the interfaces for a type, by walking down its
+ hierarchy. mono-api-info does the same as well now. This make it easier
+ to compare interface implementation.
+
+2008-12-17 Jb Evain <jbevain@novell.com>
+
* MainWindow.cs
* InfoManager.cs
* CompareContext.cs: