Skip to content

Commit 9fb8075

Browse files
committed
added ICS_S_MembersCallContext to _areadyResolved list, to avoid double-resolving locals ..and doing it wrong.
1 parent 491b3b6 commit 9fb8075

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Rubberduck.Parsing/Symbols/IdentifierReferenceResolver.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public void Resolve(VBAParser.ICS_S_ProcedureOrArrayCallContext context)
513513

514514
public void Resolve(VBAParser.ICS_S_MembersCallContext context)
515515
{
516-
if (context == null)
516+
if (context == null || _alreadyResolved.Contains(context))
517517
{
518518
return;
519519
}
@@ -559,6 +559,7 @@ public void Resolve(VBAParser.ICS_S_MembersCallContext context)
559559
}
560560

561561
ResolveInternal(fieldCall, parent);
562+
_alreadyResolved.Add(context);
562563
}
563564

564565
public void Resolve(VBAParser.ICS_S_DictionaryCallContext context)
@@ -790,10 +791,11 @@ private Declaration FindProjectScopeDeclaration(string identifierName)
790791

791792
private bool IsProcedure(Declaration item, Declaration localScope)
792793
{
793-
return (item.DeclarationType == DeclarationType.Procedure
794-
|| item.DeclarationType == DeclarationType.Function)
795-
&& (_moduleTypes.Contains(localScope.DeclarationType)
796-
&& item.ParentScope == localScope.Scope);
794+
var isProcedure = item.DeclarationType == DeclarationType.Procedure
795+
|| item.DeclarationType == DeclarationType.Function;
796+
var isSameModule = item.Project == localScope.Project
797+
&& item.ComponentName == localScope.ComponentName;
798+
return isProcedure && isSameModule;
797799
}
798800

799801
private bool IsPropertyAccessor(Declaration item, ContextAccessorType accessorType, Declaration localScope, bool isAssignmentTarget = false)

0 commit comments

Comments
 (0)