Skip to content

Commit 28685d1

Browse files
committed
Made DebugDeclaration use the module declarations at the time of calling Load instaed of at the time of the object construction.
1 parent 62de30a commit 28685d1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Rubberduck.Parsing/Symbols/DebugDeclarations.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@ namespace Rubberduck.Parsing.Symbols
1212
public class DebugDeclarations : ICustomDeclarationLoader
1313
{
1414
public static Declaration DebugPrint;
15-
private readonly DeclarationFinder _finder;
15+
private readonly RubberduckParserState _state;
1616

1717
public DebugDeclarations(RubberduckParserState state)
1818
{
19-
_finder = new DeclarationFinder(state.AllDeclarations, new CommentNode[] { }, new IAnnotation[] { });
19+
_state = state;
2020
}
2121

2222
public IReadOnlyList<Declaration> Load()
2323
{
24-
if (ThereIsAGlobalBuiltInErrVariableDeclaration(_finder))
24+
var finder = new DeclarationFinder(_state.AllDeclarations, new CommentNode[] { }, new IAnnotation[] { });
25+
26+
if (ThereIsAGlobalBuiltInErrVariableDeclaration(finder))
2527
{
2628
return new List<Declaration>();
2729
}
2830

29-
var vba = _finder.FindProject("VBA");
31+
var vba = finder.FindProject("VBA");
3032
if (vba == null)
3133
{
3234
// If the VBA project is null, we haven't loaded any COM references;

RubberduckTests/Refactoring/ExtractMethod/ExtractMethodParameterClassificationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public void shouldUseEachRuleInRulesCollectionToCheckEachReference()
5454
sut.classifyDeclarations(qSelection, declaration);
5555

5656
//Assert
57-
// 2 rules on 1 referencdes = 2 validation checks
58-
var expectedToVerify = 2;
57+
// 2 rules on 2 references = 4 validation checks
58+
var expectedToVerify = 4;
5959
emRule.Verify(emr => emr.setValidFlag(It.IsAny<IdentifierReference>(), selection),
6060
Times.Exactly(expectedToVerify));
6161

0 commit comments

Comments
 (0)