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:
authorMarek Safar <marek.safar@gmail.com>2011-09-19 14:54:26 +0400
committerMarek Safar <marek.safar@gmail.com>2011-09-19 14:54:26 +0400
commitb698dfc83b1f53e98c5c07c4d9e079f6ad7d38f2 (patch)
tree99b5963f91f918f6a5339d2133917e1e0d7197c4 /gui-compare
parent7732af2f0a9e70a2937fc3cc7233836db52bb52d (diff)
Fix generic method overload comparison
Diffstat (limited to 'gui-compare')
-rw-r--r--gui-compare/CompareContext.cs41
-rw-r--r--gui-compare/Masterinfo.cs11
-rw-r--r--gui-compare/Metadata.cs26
3 files changed, 48 insertions, 30 deletions
diff --git a/gui-compare/CompareContext.cs b/gui-compare/CompareContext.cs
index 100a20e5..26e15637 100644
--- a/gui-compare/CompareContext.cs
+++ b/gui-compare/CompareContext.cs
@@ -211,13 +211,9 @@ namespace GuiCompare {
{
var r = reference.GetTypeParameters ();
var t = target.GetTypeParameters ();
- if (r == null && t == null)
+ if (r == null && t == null || (r == null && t != null) || (r != null && t == null))
return;
- if (r.Count != t.Count) {
- throw new NotImplementedException (string.Format ("Should never happen with valid data ({0} != {1})", r.Count, t.Count));
- }
-
for (int i = 0; i < r.Count; ++i) {
var r_i = r [i];
var t_i = t [i];
@@ -368,23 +364,26 @@ namespace GuiCompare {
void CompareMembers (ComparisonNode parent,
ICompMemberContainer reference_container, ICompMemberContainer target_container)
{
+ bool is_sealed = reference_container.IsSealed;
+
CompareMemberLists (parent,
- reference_container.GetInterfaces(), target_container.GetInterfaces());
+ reference_container.GetInterfaces(), target_container.GetInterfaces(), is_sealed);
CompareMemberLists (parent,
- reference_container.GetConstructors(), target_container.GetConstructors());
+ reference_container.GetConstructors(), target_container.GetConstructors(), is_sealed);
CompareMemberLists (parent,
- reference_container.GetMethods(), target_container.GetMethods());
+ reference_container.GetMethods(), target_container.GetMethods(), is_sealed);
CompareMemberLists (parent,
- reference_container.GetProperties(), target_container.GetProperties());
+ reference_container.GetProperties(), target_container.GetProperties(), is_sealed);
CompareMemberLists (parent,
- reference_container.GetFields(), target_container.GetFields());
+ reference_container.GetFields(), target_container.GetFields(), is_sealed);
CompareMemberLists (parent,
- reference_container.GetEvents(), target_container.GetEvents());
+ reference_container.GetEvents(), target_container.GetEvents(), is_sealed);
}
void CompareMemberLists (ComparisonNode parent,
List<CompNamed> reference_list,
- List<CompNamed> target_list)
+ List<CompNamed> target_list,
+ bool isSealed)
{
int m = 0, a = 0;
@@ -482,13 +481,23 @@ namespace GuiCompare {
a++;
}
else if (c < 0) {
- /* reference name is before target name, reference name is missing from target */
- AddMissing (parent, reference_list[m]);
+ if (isSealed && reference_list[m].Name.Contains ("~")) {
+ // Ignore finalizer differences in sealed classes
+ } else {
+ /* reference name is before target name, reference name is missing from target */
+ AddMissing (parent, reference_list[m]);
+ }
+
m++;
}
else {
- /* reference name is after target name, target name is extra */
- AddExtra (parent, target_list[a]);
+ if (isSealed && target_list[a].Name.Contains ("~")) {
+ // Ignore finalizer differences in sealed classes
+ } else {
+ /* reference name is after target name, target name is extra */
+ AddExtra (parent, target_list[a]);
+ }
+
a++;
}
}
diff --git a/gui-compare/Masterinfo.cs b/gui-compare/Masterinfo.cs
index b91f99bf..9ea6edca 100644
--- a/gui-compare/Masterinfo.cs
+++ b/gui-compare/Masterinfo.cs
@@ -205,8 +205,7 @@ namespace GuiCompare {
string name = n.Attributes ["name"].Value;
if (CheckIfAdd (name, n)) {
string key = GetNodeKey (name, n);
- //keys.Add (key, name);
- keys [key] = name;
+ keys.Add (key, name);
LoadExtraData (key, n);
}
}
@@ -1045,9 +1044,11 @@ namespace GuiCompare {
public override string GetNodeKey (string name, XmlNode node)
{
- if (genericParameters != null)
- name = name + ":" + genericParameters.Count;
-
+ XmlNode genericNode = node.SelectSingleNode ("generic-parameters");
+ if (genericNode != null) {
+ name = name + "`" + genericNode.ChildNodes.Count;
+ }
+
// for explicit/implicit operators we need to include the return
// type in the key to allow matching; as a side-effect, differences
// in return types will be reported as extra/missing methods
diff --git a/gui-compare/Metadata.cs b/gui-compare/Metadata.cs
index f365f7c2..e72d459b 100644
--- a/gui-compare/Metadata.cs
+++ b/gui-compare/Metadata.cs
@@ -69,6 +69,8 @@ namespace GuiCompare {
public interface ICompMemberContainer
{
+ bool IsSealed { get; }
+
List<CompNamed> GetInterfaces ();
List<CompNamed> GetConstructors();
List<CompNamed> GetMethods();
@@ -130,27 +132,33 @@ namespace GuiCompare {
public static int Compare (CompNamed x, CompNamed y)
{
- int res = string.Compare (x.Name, y.Name);
- if (res != 0)
- return res;
-
var x_g = x as CompMethod;
var y_g = y as CompMethod;
+
if (x_g == null || y_g == null)
- return res;
+ return string.Compare (x.Name, y.Name);
var x_tp = x_g.GetTypeParameters ();
+ if (x_tp != null && x_tp.Count == 0)
+ x_tp = null;
+
var y_tp = y_g.GetTypeParameters ();
+ if (y_tp != null && y_tp.Count == 0)
+ y_tp = null;
+
if (x_tp == null && y_tp != null)
return -1;
if (x_tp != null && y_tp == null)
return 1;
- if (x_tp == null && y_tp == null)
- return res;
-
- return x_tp.Count.CompareTo (y_tp.Count);
+ if (x_tp != null && y_tp != null) {
+ var res = x_tp.Count.CompareTo (y_tp.Count);
+ if (res != 0)
+ return res;
+ }
+
+ return string.Compare (x.Name, y.Name);
}
string displayName;