diff options
-rw-r--r-- | gui-compare/CecilMetadata.cs | 33 | ||||
-rw-r--r-- | gui-compare/ChangeLog | 7 |
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: |