Skip to content

Commit 63b42b7

Browse files
Hosch250retailcoder
authored andcommitted
Clear built-in declarations' references (#1579)
* Close #1574 * Clear built-in declarations' references.
1 parent 6e7237e commit 63b42b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ public bool ClearStateCache(VBComponent component, bool notifyStateChanged = fal
445445
{
446446
if (component == null) { return false; }
447447

448+
ClearBuiltInReferences();
449+
448450
var match = new QualifiedModuleName(component);
449451
var keys = _moduleStates.Keys.Where(kvp => kvp.Equals(match))
450452
.Union(new[] { match }).Distinct(); // make sure the key is present, even if there are no declarations left
@@ -723,10 +725,10 @@ public void RemoveBuiltInDeclarations(Reference reference)
723725
var projectName = reference.Name;
724726
var key = new QualifiedModuleName(projectName, reference.FullPath, projectName);
725727
ModuleState moduleState;
726-
if (!_moduleStates.TryRemove(key, out moduleState))
728+
if (_moduleStates.TryRemove(key, out moduleState))
727729
{
728730
if (moduleState != null)
729-
{
731+
{
730732
moduleState.Dispose();
731733
}
732734

0 commit comments

Comments
 (0)