Skip to content

Commit 36c608a

Browse files
committed
Extract method MethodSignatureComparer.EqualReturnTypes
1 parent 9ed7fa3 commit 36c608a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Castle.Core/DynamicProxy/Generators/MetaMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public bool Equals(MetaMethod other)
6767
}
6868

6969
var comparer = MethodSignatureComparer.Instance;
70-
if (!comparer.EqualSignatureTypes(Method.ReturnType, other.Method.ReturnType))
70+
if (!comparer.EqualReturnTypes(Method, other.Method))
7171
{
7272
return false;
7373
}

src/Castle.Core/DynamicProxy/Generators/MethodSignatureComparer.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ public bool EqualParameters(MethodInfo x, MethodInfo y)
7979
return true;
8080
}
8181

82-
public bool EqualSignatureTypes(Type x, Type y, MethodInfo xm = null, MethodInfo ym = null)
82+
public bool EqualReturnTypes(MethodInfo x, MethodInfo y)
83+
{
84+
return EqualSignatureTypes(x.ReturnType, y.ReturnType, x, y);
85+
}
86+
87+
private bool EqualSignatureTypes(Type x, Type y, MethodInfo xm = null, MethodInfo ym = null)
8388
{
8489
if (x.IsGenericParameter != y.IsGenericParameter)
8590
{
@@ -153,7 +158,7 @@ public bool Equals(MethodInfo x, MethodInfo y)
153158

154159
return EqualNames(x, y) &&
155160
EqualGenericParameters(x, y) &&
156-
EqualSignatureTypes(x.ReturnType, y.ReturnType, x, y) &&
161+
EqualReturnTypes(x, y) &&
157162
EqualParameters(x, y);
158163
}
159164

0 commit comments

Comments
 (0)