diff options
author | Marek Habersack <grendel@twistedcode.net> | 2008-11-14 16:27:07 +0300 |
---|---|---|
committer | Marek Habersack <grendel@twistedcode.net> | 2008-11-14 16:27:07 +0300 |
commit | ad878d2298750293350db641c26b24c66a9a606c (patch) | |
tree | 2b05b2c89f8e3bea9e53fd3825efc7a4c70c0bed /gui-compare | |
parent | fdac91f37ddcf41be8af740d6148086f6b83fa2a (diff) |
2008-11-14 Marek Habersack <mhabersack@novell.com>
* CecilMetadata.cs:
Check if methods with special names are explicit interface
implementations and, if yes, include them in comparison.
svn path=/trunk/mono-tools/; revision=118848
Diffstat (limited to 'gui-compare')
-rw-r--r-- | gui-compare/CecilMetadata.cs | 32 | ||||
-rw-r--r-- | gui-compare/ChangeLog | 2 |
2 files changed, 25 insertions, 9 deletions
diff --git a/gui-compare/CecilMetadata.cs b/gui-compare/CecilMetadata.cs index 232d4fac..87dd55ab 100644 --- a/gui-compare/CecilMetadata.cs +++ b/gui-compare/CecilMetadata.cs @@ -68,6 +68,15 @@ namespace GuiCompare { rv = rv.Replace ('>', ']'); return rv; } + + static bool IsExplicitInterfaceImplementation (MethodDefinition md) + { + OverrideCollection overrides = md.Overrides; + if (overrides == null || overrides.Count == 0) + return false; + + return true; + } public static void PopulateMemberLists (TypeDefinition fromDef, List<CompNamed> interface_list, @@ -77,6 +86,7 @@ namespace GuiCompare { List<CompNamed> field_list, List<CompNamed> event_list) { + bool debug = fromDef.FullName == "System.Web.UI.WebControls.DataPagerField"; if (interface_list != null) { foreach (TypeReference ifc in fromDef.Interfaces) { TypeDefinition ifc_def = CecilUtils.Resolver.Resolve (ifc); @@ -104,15 +114,13 @@ namespace GuiCompare { if (method_list != null) { foreach (MethodDefinition md in fromDef.Methods) { if (md.IsSpecialName) { - if (!md.Name.StartsWith("op_")) + if (!md.Name.StartsWith("op_") && !IsExplicitInterfaceImplementation (md)) + continue; + } else { + if (md.IsAssembly) continue; - } - if (md.IsAssembly) - continue; - if (md.IsPrivate) { - OverrideCollection overrides = md.Overrides; - if (overrides == null || overrides.Count == 0) + if (md.IsPrivate && !IsExplicitInterfaceImplementation (md)) continue; } @@ -120,13 +128,19 @@ namespace GuiCompare { } } if (property_list != null) { + MethodDefinition getMethod, setMethod; foreach (PropertyDefinition pd in fromDef.Properties) { bool include_set = true; bool include_get = true; - if (pd.SetMethod == null || (pd.SetMethod.IsPrivate || pd.SetMethod.IsAssembly)) + + setMethod = pd.SetMethod; + if (setMethod == null || (setMethod.IsPrivate || setMethod.IsAssembly)) include_set = false; - if (pd.GetMethod == null || (pd.GetMethod.IsPrivate || pd.GetMethod.IsAssembly)) + + getMethod = pd.GetMethod; + if (getMethod == null || (getMethod.IsPrivate || getMethod.IsAssembly)) include_get = false; + if (include_set || include_get) property_list.Add (new CecilProperty (pd)); } diff --git a/gui-compare/ChangeLog b/gui-compare/ChangeLog index 48bc1c43..66ef3009 100644 --- a/gui-compare/ChangeLog +++ b/gui-compare/ChangeLog @@ -6,6 +6,8 @@ When populating member lists, check if a method is an explicit interface implementation and, if yes, include it in the list to avoid false negatives. + Check if methods with special names are explicit interface + implementations and, if yes, include them in comparison. 2008-08-15 Chris Toshok <toshok@ximian.com> |