@@ -263,25 +263,6 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
263
263
if (auto *VD = dyn_cast<ValueDecl>(D)) {
264
264
if (!report (VD))
265
265
return false ;
266
- if (auto *SD = dyn_cast<SubscriptDecl>(VD)) {
267
- // Avoid indexing the indices, only walk the getter/setter.
268
- if (SD->getGetter ())
269
- if (SourceEntityWalker::walk (cast<Decl>(SD->getGetter ())))
270
- return false ;
271
- if (SD->getSetter ())
272
- if (SourceEntityWalker::walk (cast<Decl>(SD->getSetter ())))
273
- return false ;
274
- if (SD->hasAddressors ()) {
275
- if (auto FD = SD->getAddressor ())
276
- SourceEntityWalker::walk (cast<Decl>(FD));
277
- if (Cancelled)
278
- return false ;
279
- if (auto FD = SD->getMutableAddressor ())
280
- SourceEntityWalker::walk (cast<Decl>(FD));
281
- }
282
- walkToDeclPost (D);
283
- return false ; // already walked what we needed.
284
- }
285
266
}
286
267
if (auto *ED = dyn_cast<ExtensionDecl>(D))
287
268
return reportExtension (ED);
@@ -885,12 +866,13 @@ bool IndexSwiftASTWalker::reportExtension(ExtensionDecl *D) {
885
866
bool IndexSwiftASTWalker::report (ValueDecl *D) {
886
867
if (startEntityDecl (D)) {
887
868
// Pass accessors.
888
- if (auto VarD = dyn_cast<VarDecl >(D)) {
869
+ if (auto StoreD = dyn_cast<AbstractStorageDecl >(D)) {
889
870
auto isNullOrImplicit = [](const Decl *D) -> bool {
890
871
return !D || D->isImplicit ();
891
872
};
892
- if (isNullOrImplicit (VarD->getGetter ()) &&
893
- isNullOrImplicit (VarD->getSetter ())) {
873
+ if (isa<VarDecl>(D) && isNullOrImplicit (StoreD->getGetter ()) &&
874
+ isNullOrImplicit (StoreD->getSetter ())) {
875
+ auto VarD = cast<VarDecl>(D);
894
876
// No actual getter or setter, pass 'pseudo' accessors.
895
877
// We create accessor entities so we can implement the functionality
896
878
// of libclang, which reports implicit method property accessor
@@ -903,31 +885,31 @@ bool IndexSwiftASTWalker::report(ValueDecl *D) {
903
885
if (!reportPseudoSetterDecl (VarD))
904
886
return false ;
905
887
} else {
906
- if (auto FD = VarD ->getGetter ())
888
+ if (auto FD = StoreD ->getGetter ())
907
889
SourceEntityWalker::walk (cast<Decl>(FD));
908
890
if (Cancelled)
909
891
return false ;
910
- if (auto FD = VarD ->getSetter ())
892
+ if (auto FD = StoreD ->getSetter ())
911
893
SourceEntityWalker::walk (cast<Decl>(FD));
912
894
if (Cancelled)
913
895
return false ;
914
896
}
915
- if (VarD ->hasObservers ()) {
916
- if (auto FD = VarD ->getWillSetFunc ())
897
+ if (StoreD ->hasObservers ()) {
898
+ if (auto FD = StoreD ->getWillSetFunc ())
917
899
SourceEntityWalker::walk (cast<Decl>(FD));
918
900
if (Cancelled)
919
901
return false ;
920
- if (auto FD = VarD ->getDidSetFunc ())
902
+ if (auto FD = StoreD ->getDidSetFunc ())
921
903
SourceEntityWalker::walk (cast<Decl>(FD));
922
904
if (Cancelled)
923
905
return false ;
924
906
}
925
- if (VarD ->hasAddressors ()) {
926
- if (auto FD = VarD ->getAddressor ())
907
+ if (StoreD ->hasAddressors ()) {
908
+ if (auto FD = StoreD ->getAddressor ())
927
909
SourceEntityWalker::walk (cast<Decl>(FD));
928
910
if (Cancelled)
929
911
return false ;
930
- if (auto FD = VarD ->getMutableAddressor ())
912
+ if (auto FD = StoreD ->getMutableAddressor ())
931
913
SourceEntityWalker::walk (cast<Decl>(FD));
932
914
}
933
915
} else if (auto NTD = dyn_cast<NominalTypeDecl>(D)) {
0 commit comments