Skip to content

Commit 1273d4e

Browse files
committed
Extract method accessibility check from GetMethodToGenerate
1 parent 57e666d commit 1273d4e

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

src/Castle.Core/DynamicProxy/Contributors/ClassMembersCollector.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ public ClassMembersCollector(Type targetType)
2828

2929
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
3030
{
31-
if (ProxyUtil.IsAccessibleMethod(method) == false)
32-
{
33-
return null;
34-
}
35-
3631
var accepted = AcceptMethod(method, true, hook);
3732
if (!accepted && !method.IsAbstract)
3833
{

src/Castle.Core/DynamicProxy/Contributors/InterfaceMembersCollector.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ public InterfaceMembersCollector(Type @interface)
2828

2929
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
3030
{
31-
if (ProxyUtil.IsAccessibleMethod(method) == false)
32-
{
33-
return null;
34-
}
35-
3631
var proxyable = AcceptMethod(method, true, hook);
3732
if (!proxyable && !method.IsAbstract)
3833
{

src/Castle.Core/DynamicProxy/Contributors/InterfaceMembersOnClassCollector.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ public InterfaceMembersOnClassCollector(Type type, bool onlyProxyVirtual, Interf
3232

3333
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
3434
{
35-
if (ProxyUtil.IsAccessibleMethod(method) == false)
36-
{
37-
return null;
38-
}
39-
4035
if (onlyProxyVirtual && IsVirtuallyImplementedInterfaceMethod(method))
4136
{
4237
return null;

src/Castle.Core/DynamicProxy/Contributors/MembersCollector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ MetaMethod AddMethod(MethodInfo method, bool isStandalone)
143143
return null;
144144
}
145145

146+
if (ProxyUtil.IsAccessibleMethod(method) == false)
147+
{
148+
return null;
149+
}
150+
146151
var methodToGenerate = GetMethodToGenerate(method, hook, isStandalone);
147152
if (methodToGenerate != null)
148153
{

src/Castle.Core/DynamicProxy/Contributors/WrappedClassMembersCollector.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public override void CollectMembersToProxy(IProxyGenerationHook hook, IMembersCo
3737

3838
protected override MetaMethod GetMethodToGenerate(MethodInfo method, IProxyGenerationHook hook, bool isStandalone)
3939
{
40-
if (ProxyUtil.IsAccessibleMethod(method) == false)
41-
{
42-
return null;
43-
}
44-
4540
var interceptable = AcceptMethodPreScreen(method, true, hook);
4641
if (!interceptable)
4742
{

0 commit comments

Comments
 (0)