@@ -13,8 +13,8 @@ internal static bool TryFindFirst(ITypeSymbol type, Compilation compilation, Sea
1313 {
1414 if ( search == Search . TopLevel )
1515 {
16- return TryFindIDisposableDispose ( type , compilation , search , out disposeMethod ) ||
17- TryFindVirtualDispose ( type , compilation , search , out disposeMethod ) ;
16+ return TryFind ( type , compilation , search , out disposeMethod ) ||
17+ TryFindVirtual ( type , compilation , search , out disposeMethod ) ;
1818 }
1919
2020 while ( type . IsAssignableTo ( KnownSymbol . IDisposable , compilation ) )
@@ -38,11 +38,11 @@ internal static bool IsAccessibleOn(ITypeSymbol type, Compilation compilation)
3838 return type . IsAssignableTo ( KnownSymbol . IDisposable , compilation ) ;
3939 }
4040
41- return TryFindIDisposableDispose ( type , compilation , Search . Recursive , out var disposeMethod ) &&
41+ return TryFind ( type , compilation , Search . Recursive , out var disposeMethod ) &&
4242 disposeMethod . ExplicitInterfaceImplementations . IsEmpty ;
4343 }
4444
45- internal static bool TryFindIDisposableDispose ( ITypeSymbol type , Compilation compilation , Search search , [ NotNullWhen ( true ) ] out IMethodSymbol ? disposeMethod )
45+ internal static bool TryFind ( ITypeSymbol type , Compilation compilation , Search search , [ NotNullWhen ( true ) ] out IMethodSymbol ? disposeMethod )
4646 {
4747 disposeMethod = null ;
4848 if ( ! type . IsAssignableTo ( KnownSymbol . IDisposable , compilation ) )
@@ -52,18 +52,18 @@ internal static bool TryFindIDisposableDispose(ITypeSymbol type, Compilation com
5252
5353 if ( search == Search . TopLevel )
5454 {
55- return type . TryFindFirstMethod ( "Dispose" , x => IsIDisposableDispose ( x ) , out disposeMethod ) ;
55+ return type . TryFindFirstMethod ( "Dispose" , x => IsMatch ( x ) , out disposeMethod ) ;
5656 }
5757
58- return type . TryFindFirstMethodRecursive ( "Dispose" , x => IsIDisposableDispose ( x ) , out disposeMethod ) ;
58+ return type . TryFindFirstMethodRecursive ( "Dispose" , x => IsMatch ( x ) , out disposeMethod ) ;
5959
60- static bool IsIDisposableDispose ( IMethodSymbol candidate )
60+ static bool IsMatch ( IMethodSymbol candidate )
6161 {
6262 return candidate is { DeclaredAccessibility : Accessibility . Public , ReturnsVoid : true , Name : "Dispose" , Parameters : { Length : 0 } } ;
6363 }
6464 }
6565
66- internal static bool TryFindVirtualDispose ( ITypeSymbol type , Compilation compilation , Search search , [ NotNullWhen ( true ) ] out IMethodSymbol ? disposeMethod )
66+ internal static bool TryFindVirtual ( ITypeSymbol type , Compilation compilation , Search search , [ NotNullWhen ( true ) ] out IMethodSymbol ? disposeMethod )
6767 {
6868 disposeMethod = null ;
6969 if ( ! type . IsAssignableTo ( KnownSymbol . IDisposable , compilation ) )
@@ -73,12 +73,12 @@ internal static bool TryFindVirtualDispose(ITypeSymbol type, Compilation compila
7373
7474 if ( search == Search . TopLevel )
7575 {
76- return type . TryFindFirstMethod ( "Dispose" , x => IsIDisposableDispose ( x ) , out disposeMethod ) ;
76+ return type . TryFindFirstMethod ( "Dispose" , x => IsMatch ( x ) , out disposeMethod ) ;
7777 }
7878
79- return type . TryFindFirstMethodRecursive ( "Dispose" , x => IsIDisposableDispose ( x ) , out disposeMethod ) ;
79+ return type . TryFindFirstMethodRecursive ( "Dispose" , x => IsMatch ( x ) , out disposeMethod ) ;
8080
81- static bool IsIDisposableDispose ( IMethodSymbol candidate )
81+ static bool IsMatch ( IMethodSymbol candidate )
8282 {
8383 return IsOverrideDispose ( candidate ) ||
8484 IsVirtualDispose ( candidate ) ;
0 commit comments