Skip to content

Commit 8b61706

Browse files
committed
Made the ParseCoordinator remove all references upon reparse and not only those to the built-in declarations and the modules that have been modified.
1 parent 50e6014 commit 8b61706

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Rubberduck.Parsing/VBA/ParseCoordinator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private void ExecuteCommonParseActivities(List<IVBComponent> toParse, Cancellati
215215
token.ThrowIfCancellationRequested();
216216

217217
_projectDeclarations.Clear();
218-
State.ClearBuiltInReferences();
218+
State.ClearAllReferences();
219219

220220
ParseComponents(toParse, token);
221221

@@ -612,7 +612,7 @@ private void ParseAllInternal(object requestor, CancellationToken token)
612612

613613
token.ThrowIfCancellationRequested();
614614

615-
var componentsRemoved = ClearStateCashForRemovedComponents(components);
615+
var componentsRemoved = CleanUpRemovedComponents(components);
616616

617617
token.ThrowIfCancellationRequested();
618618

@@ -642,10 +642,10 @@ private void ParseAllInternal(object requestor, CancellationToken token)
642642
}
643643

644644
/// <summary>
645-
/// Clears state cach for removed components.
645+
/// Clears state cache of removed components.
646646
/// Returns whether components have been removed.
647647
/// </summary>
648-
private bool ClearStateCashForRemovedComponents(List<IVBComponent> components)
648+
private bool CleanUpRemovedComponents(List<IVBComponent> components)
649649
{
650650
var removedModuledecalrations = RemovedModuleDeclarations(components);
651651
var componentRemoved = removedModuledecalrations.Any();

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,14 @@ public void ClearBuiltInReferences()
742742
}
743743
}
744744

745+
public void ClearAllReferences()
746+
{
747+
foreach (var declaration in AllDeclarations)
748+
{
749+
declaration.ClearReferences();
750+
}
751+
}
752+
745753
public bool ClearStateCache(IVBComponent component, bool notifyStateChanged = false)
746754
{
747755
return component != null && ClearStateCache(new QualifiedModuleName(component), notifyStateChanged);

0 commit comments

Comments
 (0)