File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Rubberduck.Parsing/VBA/DeclarationCaching Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -541,21 +541,26 @@ public ParameterDeclaration FindParameterFromArgument(VBAParser.ArgumentExpressi
541
541
return null ;
542
542
}
543
543
544
- var callStmt = argExpression ? . GetAncestor < VBAParser . CallStmtContext > ( ) ;
545
- var procedureName = callStmt ? . GetDescendent < VBAParser . LExpressionContext > ( )
546
- . GetDescendents < VBAParser . IdentifierContext > ( )
547
- . LastOrDefault ( ) ? . GetText ( ) ;
548
- if ( procedureName == null )
544
+ var callStmt = argExpression . GetAncestor < VBAParser . CallStmtContext > ( ) ;
545
+
546
+ var identifier = callStmt ?
547
+ . GetDescendent < VBAParser . LExpressionContext > ( )
548
+ . GetDescendents < VBAParser . IdentifierContext > ( )
549
+ . LastOrDefault ( ) ;
550
+
551
+ if ( identifier == null )
549
552
{
550
553
// if we don't know what we're calling, we can't dig any further
551
554
return null ;
552
555
}
553
556
554
- var procedure = MatchName ( procedureName )
555
- . SingleOrDefault ( p =>
556
- ( ! p . DeclarationType . HasFlag ( DeclarationType . Property ) ||
557
- p . DeclarationType . HasFlag ( DeclarationType . PropertyGet ) ) &&
558
- p . References . Any ( r => callStmt == r . Context . GetAncestor < VBAParser . CallStmtContext > ( ) ) ) ;
557
+ var selection = new QualifiedSelection ( enclosingProcedure . QualifiedModuleName , identifier . GetSelection ( ) ) ;
558
+ if ( ! _referencesBySelection . TryGetValue ( selection , out var matches ) )
559
+ {
560
+ return null ;
561
+ }
562
+
563
+ var procedure = matches . SingleOrDefault ( ) ? . Declaration ;
559
564
if ( procedure ? . ParentScopeDeclaration is ClassModuleDeclaration )
560
565
{
561
566
// we can't know that the member is on the class' default interface
You can’t perform that action at this time.
0 commit comments