@@ -35,19 +35,18 @@ namespace Rubberduck.Inspections.QuickFixes
35
35
/// </example>
36
36
public sealed class PassParameterByValueQuickFix : QuickFixBase
37
37
{
38
- //TODO: Change this to IDeclarationFinderProvider once the FIXME below is handled.
39
- private readonly RubberduckParserState _state ;
38
+ private readonly IDeclarationFinderProvider _declarationFinderProvider ;
40
39
41
- public PassParameterByValueQuickFix ( RubberduckParserState state )
40
+ public PassParameterByValueQuickFix ( IDeclarationFinderProvider declarationFinderProvider )
42
41
: base ( typeof ( ParameterCanBeByValInspection ) )
43
42
{
44
- _state = state ;
43
+ _declarationFinderProvider = declarationFinderProvider ;
45
44
}
46
45
47
46
public override void Fix ( IInspectionResult result , IRewriteSession rewriteSession )
48
47
{
49
48
if ( result . Target . ParentDeclaration . DeclarationType == DeclarationType . Event ||
50
- _state . DeclarationFinder . FindAllInterfaceMembers ( ) . Contains ( result . Target . ParentDeclaration ) )
49
+ _declarationFinderProvider . DeclarationFinder . FindAllInterfaceMembers ( ) . Contains ( result . Target . ParentDeclaration ) )
51
50
{
52
51
FixMethods ( result . Target , rewriteSession ) ;
53
52
}
@@ -62,7 +61,7 @@ public override void Fix(IInspectionResult result, IRewriteSession rewriteSessio
62
61
private void FixMethods ( Declaration target , IRewriteSession rewriteSession )
63
62
{
64
63
var declarationParameters =
65
- _state . DeclarationFinder . UserDeclarations ( DeclarationType . Parameter )
64
+ _declarationFinderProvider . DeclarationFinder . UserDeclarations ( DeclarationType . Parameter )
66
65
. Where ( declaration => Equals ( declaration . ParentDeclaration , target . ParentDeclaration ) )
67
66
. OrderBy ( o => o . Selection . StartLine )
68
67
. ThenBy ( t => t . Selection . StartColumn )
@@ -75,18 +74,18 @@ private void FixMethods(Declaration target, IRewriteSession rewriteSession)
75
74
}
76
75
77
76
var members = target . ParentDeclaration . DeclarationType == DeclarationType . Event
78
- ? _state . DeclarationFinder
77
+ ? _declarationFinderProvider . DeclarationFinder
79
78
. FindEventHandlers ( target . ParentDeclaration )
80
79
. ToList ( )
81
- : _state . DeclarationFinder
80
+ : _declarationFinderProvider . DeclarationFinder
82
81
. FindInterfaceImplementationMembers ( target . ParentDeclaration )
83
82
. Cast < Declaration > ( )
84
83
. ToList ( ) ;
85
84
86
85
foreach ( var member in members )
87
86
{
88
87
var parameters =
89
- _state . DeclarationFinder . UserDeclarations ( DeclarationType . Parameter )
88
+ _declarationFinderProvider . DeclarationFinder . UserDeclarations ( DeclarationType . Parameter )
90
89
. Where ( declaration => Equals ( declaration . ParentDeclaration , member ) )
91
90
. OrderBy ( o => o . Selection . StartLine )
92
91
. ThenBy ( t => t . Selection . StartColumn )
0 commit comments