File tree Expand file tree Collapse file tree 3 files changed +2
-39
lines changed Expand file tree Collapse file tree 3 files changed +2
-39
lines changed Original file line number Diff line number Diff line change @@ -946,9 +946,6 @@ class alignas(1 << TypeAlignInBits) TypeBase {
946
946
// / static conformance associated with the conforming type.
947
947
bool hasDependentProtocolConformances ();
948
948
949
- // / Retrieve the type declaration directly referenced by this type, if any.
950
- TypeDecl *getDirectlyReferencedTypeDecl () const ;
951
-
952
949
private:
953
950
// Make vanilla new/delete illegal for Types.
954
951
void *operator new (size_t Bytes) throw () = delete ;
Original file line number Diff line number Diff line change @@ -955,38 +955,6 @@ Type TypeBase::getRValueInstanceType() {
955
955
return type->getInOutObjectType ();
956
956
}
957
957
958
- TypeDecl *TypeBase::getDirectlyReferencedTypeDecl () const {
959
- if (auto module = dyn_cast<ModuleType>(this ))
960
- return module ->getModule ();
961
-
962
- if (auto nominal = dyn_cast<NominalType>(this ))
963
- return nominal->getDecl ();
964
-
965
- if (auto bound = dyn_cast<BoundGenericType>(this ))
966
- return bound->getDecl ();
967
-
968
- if (auto unbound = dyn_cast<UnboundGenericType>(this ))
969
- return unbound->getDecl ();
970
-
971
- if (auto alias = dyn_cast<NameAliasType>(this ))
972
- return alias->getDecl ();
973
-
974
- if (auto gp = dyn_cast<GenericTypeParamType>(this ))
975
- return gp->getDecl ();
976
-
977
- if (auto depMem = dyn_cast<DependentMemberType>(this ))
978
- return depMem->getAssocType ();
979
-
980
- if (auto archetype = dyn_cast<ArchetypeType>(this )) {
981
- if (auto assoc = archetype->getAssocType ())
982
- return assoc;
983
-
984
- return nullptr ;
985
- }
986
-
987
- return nullptr ;
988
- }
989
-
990
958
// / \brief Collect the protocols in the existential type T into the given
991
959
// / vector.
992
960
static void addProtocols (Type T, SmallVectorImpl<ProtocolDecl *> &Protocols) {
Original file line number Diff line number Diff line change @@ -575,8 +575,7 @@ bool IndexSwiftASTWalker::passRelatedType(const TypeLoc &Ty) {
575
575
}
576
576
577
577
if (Ty.getType ()) {
578
- if (auto nominal = dyn_cast_or_null<NominalTypeDecl>(
579
- Ty.getType ()->getDirectlyReferencedTypeDecl ()))
578
+ if (auto nominal = Ty.getType ()->getAnyNominal ())
580
579
if (!passRelated (nominal, Ty.getLoc ()))
581
580
return false ;
582
581
}
@@ -644,8 +643,7 @@ bool IndexSwiftASTWalker::reportPseudoAccessor(AbstractStorageDecl *D,
644
643
NominalTypeDecl *
645
644
IndexSwiftASTWalker::getTypeLocAsNominalTypeDecl (const TypeLoc &Ty) {
646
645
if (Type T = Ty.getType ())
647
- return dyn_cast_or_null<NominalTypeDecl>(
648
- T->getDirectlyReferencedTypeDecl ());
646
+ return T->getAnyNominal ();
649
647
if (IdentTypeRepr *T = dyn_cast_or_null<IdentTypeRepr>(Ty.getTypeRepr ())) {
650
648
auto Comp = T->getComponentRange ().back ();
651
649
if (auto NTD = dyn_cast_or_null<NominalTypeDecl>(Comp->getBoundDecl ()))
You can’t perform that action at this time.
0 commit comments