Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/next' into Issue5408_SettingsW…
…indowAccessKeys
- Loading branch information
Showing
804 changed files
with
26,436 additions
and
9,695 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 19 additions & 27 deletions
46
Rubberduck.CodeAnalysis/Inspections/Abstract/DeclarationInspectionBaseBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,52 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Rubberduck.Parsing.Inspections.Abstract; | ||
using Rubberduck.Parsing.Symbols; | ||
using Rubberduck.Parsing.VBA; | ||
using Rubberduck.Parsing.VBA.DeclarationCaching; | ||
using Rubberduck.VBEditor; | ||
|
||
namespace Rubberduck.Inspections.Abstract | ||
namespace Rubberduck.CodeAnalysis.Inspections.Abstract | ||
{ | ||
public abstract class DeclarationInspectionBaseBase : InspectionBase | ||
/// <summary> | ||
/// This is a base class for the other declaration inspection base classes. It should not be implemented directly by concrete inspections. | ||
/// </summary> | ||
internal abstract class DeclarationInspectionBaseBase : InspectionBase | ||
{ | ||
protected readonly DeclarationType[] RelevantDeclarationTypes; | ||
protected readonly DeclarationType[] ExcludeDeclarationTypes; | ||
private readonly DeclarationType[] _relevantDeclarationTypes; | ||
private readonly DeclarationType[] _excludeDeclarationTypes; | ||
|
||
protected DeclarationInspectionBaseBase(RubberduckParserState state, params DeclarationType[] relevantDeclarationTypes) | ||
: base(state) | ||
protected DeclarationInspectionBaseBase(IDeclarationFinderProvider declarationFinderProvider, params DeclarationType[] relevantDeclarationTypes) | ||
: base(declarationFinderProvider) | ||
{ | ||
RelevantDeclarationTypes = relevantDeclarationTypes; | ||
ExcludeDeclarationTypes = new DeclarationType[0]; | ||
_relevantDeclarationTypes = relevantDeclarationTypes; | ||
_excludeDeclarationTypes = new DeclarationType[0]; | ||
} | ||
|
||
protected DeclarationInspectionBaseBase(RubberduckParserState state, DeclarationType[] relevantDeclarationTypes, DeclarationType[] excludeDeclarationTypes) | ||
: base(state) | ||
protected DeclarationInspectionBaseBase(IDeclarationFinderProvider declarationFinderProvider, DeclarationType[] relevantDeclarationTypes, DeclarationType[] excludeDeclarationTypes) | ||
: base(declarationFinderProvider) | ||
{ | ||
RelevantDeclarationTypes = relevantDeclarationTypes; | ||
ExcludeDeclarationTypes = excludeDeclarationTypes; | ||
_relevantDeclarationTypes = relevantDeclarationTypes; | ||
_excludeDeclarationTypes = excludeDeclarationTypes; | ||
} | ||
|
||
protected abstract IEnumerable<IInspectionResult> DoGetInspectionResults(QualifiedModuleName module, DeclarationFinder finder); | ||
|
||
protected override IEnumerable<IInspectionResult> DoGetInspectionResults() | ||
protected override IEnumerable<IInspectionResult> DoGetInspectionResults(DeclarationFinder finder) | ||
{ | ||
var finder = DeclarationFinderProvider.DeclarationFinder; | ||
|
||
return finder.UserDeclarations(DeclarationType.Module) | ||
.Concat(finder.UserDeclarations(DeclarationType.Project)) | ||
.Where(declaration => declaration != null) | ||
.SelectMany(declaration => DoGetInspectionResults(declaration.QualifiedModuleName, finder)) | ||
.ToList(); | ||
} | ||
|
||
protected virtual IEnumerable<IInspectionResult> DoGetInspectionResults(QualifiedModuleName module) | ||
{ | ||
var finder = DeclarationFinderProvider.DeclarationFinder; | ||
return DoGetInspectionResults(module, finder); | ||
} | ||
|
||
protected virtual IEnumerable<Declaration> RelevantDeclarationsInModule(QualifiedModuleName module, DeclarationFinder finder) | ||
{ | ||
var potentiallyRelevantDeclarations = RelevantDeclarationTypes.Length == 0 | ||
var potentiallyRelevantDeclarations = _relevantDeclarationTypes.Length == 0 | ||
? finder.Members(module) | ||
: RelevantDeclarationTypes | ||
: _relevantDeclarationTypes | ||
.SelectMany(declarationType => finder.Members(module, declarationType)) | ||
.Distinct(); | ||
return potentiallyRelevantDeclarations | ||
.Where(declaration => !ExcludeDeclarationTypes.Contains(declaration.DeclarationType)); | ||
.Where(declaration => !_excludeDeclarationTypes.Contains(declaration.DeclarationType)); | ||
} | ||
} | ||
} |
15 changes: 7 additions & 8 deletions
15
Rubberduck.CodeAnalysis/Inspections/Abstract/DeclarationInspectionMultiResultBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.