private Declaration ResolveIndexExpressionAsMethod(VBAParser.LExpressionContext lExpressionOfIndexExpression, QualifiedModuleName containingModule, DeclarationFinder finder) { //For functions and properties, the identifier will be at the end of the lExpression. var qualifiedSelection = new QualifiedSelection(containingModule, lExpressionOfIndexExpression.GetSelection().Collapse()); var candidate = finder .ContainingIdentifierReferences(qualifiedSelection) .LastOrDefault() ?.Declaration; return(candidate?.DeclarationType.HasFlag(DeclarationType.Member) ?? false ? candidate : null); }