@@ -878,10 +878,6 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
878
878
auto AfterDollar = Loc.getAdvancedLoc (1 );
879
879
reportRef (Wrapped, AfterDollar, Info, None);
880
880
}
881
- } else if (auto *TAD = dyn_cast<TypeAliasDecl>(D)) {
882
- TypeLoc TL (TAD->getUnderlyingTypeRepr (), TAD->getUnderlyingType ());
883
- if (!reportRelatedTypeRef (TL, (SymbolRoleSet)SymbolRole::Reference, D, /* isImplicit=*/ true , Loc))
884
- return false ;
885
881
}
886
882
887
883
return true ;
@@ -966,18 +962,7 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
966
962
bool startEntityDecl (ValueDecl *D);
967
963
968
964
bool reportRelatedRef (ValueDecl *D, SourceLoc Loc, bool isImplicit, SymbolRoleSet Relations, Decl *Related);
969
-
970
- // / Report references for dependent types
971
- // /
972
- // / NOTE: If the dependent type is a typealias, report the underlying types as well.
973
- // /
974
- // / \param Ty The type being referenced.
975
- // / \param Relations The relationship between the referenced type and the passed Decl.
976
- // / \param Related The Decl that is referencing the type.
977
- // / \param isImplicit Whether the reference is implicit, such as for a typealias' underlying type.
978
- // / \param Loc The location of the reference, otherwise the location of the TypeLoc is used.
979
- bool reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations, Decl *Related,
980
- bool isImplicit=false , SourceLoc Loc={});
965
+ bool reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations, Decl *Related);
981
966
bool reportInheritedTypeRefs (
982
967
ArrayRef<InheritedEntry> Inherited, Decl *Inheritee);
983
968
NominalTypeDecl *getTypeLocAsNominalTypeDecl (const TypeLoc &Ty);
@@ -1393,37 +1378,20 @@ bool IndexSwiftASTWalker::reportInheritedTypeRefs(ArrayRef<InheritedEntry> Inher
1393
1378
return true ;
1394
1379
}
1395
1380
1396
- bool IndexSwiftASTWalker::reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations,
1397
- Decl *Related, bool Implicit, SourceLoc Loc) {
1398
- if (auto *composite = llvm::dyn_cast_or_null<CompositionTypeRepr>(Ty.getTypeRepr ())) {
1399
- SourceLoc IdLoc = Loc.isValid () ? Loc : composite->getSourceLoc ();
1400
- for (auto *Type : composite->getTypes ()) {
1401
- if (!reportRelatedTypeRef (Type, Relations, Related, /* isImplicit=*/ Implicit, IdLoc))
1402
- return false ;
1403
- }
1404
-
1405
- return true ;
1406
- } else if (auto *declRefTR = dyn_cast_or_null<DeclRefTypeRepr>(Ty.getTypeRepr ())) {
1407
- SourceLoc IdLoc = Loc.isValid () ? Loc : declRefTR->getLoc ();
1381
+ bool IndexSwiftASTWalker::reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations, Decl *Related) {
1382
+ if (auto *declRefTR = dyn_cast_or_null<DeclRefTypeRepr>(Ty.getTypeRepr ())) {
1383
+ SourceLoc IdLoc = declRefTR->getLoc ();
1408
1384
NominalTypeDecl *NTD = nullptr ;
1409
- bool isImplicit = Implicit ;
1385
+ bool isImplicit = false ;
1410
1386
if (auto *VD = declRefTR->getBoundDecl ()) {
1411
1387
if (auto *TAD = dyn_cast<TypeAliasDecl>(VD)) {
1412
1388
IndexSymbol Info;
1413
- if (isImplicit)
1414
- Info.roles |= (unsigned )SymbolRole::Implicit;
1415
1389
if (!reportRef (TAD, IdLoc, Info, None))
1416
1390
return false ;
1417
1391
if (auto Ty = TAD->getUnderlyingType ()) {
1418
1392
NTD = Ty->getAnyNominal ();
1419
1393
isImplicit = true ;
1420
1394
}
1421
-
1422
- if (isa_and_nonnull<CompositionTypeRepr>(TAD->getUnderlyingTypeRepr ())) {
1423
- TypeLoc TL (TAD->getUnderlyingTypeRepr (), TAD->getUnderlyingType ());
1424
- if (!reportRelatedTypeRef (TL, Relations, Related, /* isImplicit=*/ true , IdLoc))
1425
- return false ;
1426
- }
1427
1395
} else {
1428
1396
NTD = dyn_cast<NominalTypeDecl>(VD);
1429
1397
}
0 commit comments