@@ -378,7 +378,7 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
378
378
return true ;
379
379
}
380
380
381
- Decl *getParentDecl () {
381
+ Decl *getParentDecl () const {
382
382
if (!EntitiesStack.empty ())
383
383
return EntitiesStack.back ().D ;
384
384
return nullptr ;
@@ -390,25 +390,25 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
390
390
EntitiesStack.back ().RefsToSuppress .push_back (Loc);
391
391
}
392
392
393
- bool isRepressed (SourceLoc Loc) {
393
+ bool isRepressed (SourceLoc Loc) const {
394
394
if (EntitiesStack.empty () || Loc.isInvalid ())
395
395
return false ;
396
396
auto &Suppressed = EntitiesStack.back ().RefsToSuppress ;
397
397
return std::find (Suppressed.begin (), Suppressed.end (), Loc) != Suppressed.end ();
398
398
399
399
}
400
400
401
- Expr *getContainingExpr (size_t index) {
401
+ Expr *getContainingExpr (size_t index) const {
402
402
if (ExprStack.size () > index)
403
403
return ExprStack.end ()[-(index + 1 )];
404
404
return nullptr ;
405
405
}
406
406
407
- Expr *getCurrentExpr () {
407
+ Expr *getCurrentExpr () const {
408
408
return ExprStack.empty () ? nullptr : ExprStack.back ();
409
409
}
410
410
411
- Expr *getParentExpr () {
411
+ Expr *getParentExpr () const {
412
412
return getContainingExpr (1 );
413
413
}
414
414
@@ -466,8 +466,11 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
466
466
bool shouldIndex (ValueDecl *D, bool IsRef) const {
467
467
if (D->isImplicit () && !isa<ConstructorDecl>(D))
468
468
return false ;
469
- if (!IdxConsumer.indexLocals () && isLocalSymbol (D) && (!isa<ParamDecl>(D) || IsRef))
470
- return false ;
469
+
470
+ if (!IdxConsumer.indexLocals () && isLocalSymbol (D))
471
+ return isa<ParamDecl>(D) && !IsRef &&
472
+ D->getDeclContext ()->getContextKind () != DeclContextKind::AbstractClosureExpr;
473
+
471
474
if (D->isPrivateStdlibDecl ())
472
475
return false ;
473
476
0 commit comments