AST: Introduce abstraction for extension/type decl inheritance clauses.

Wrap the `InheritedEntry` array available on both `ExtensionDecl` and
`TypeDecl` in a new `InheritedTypes` class. This class will provide shared
conveniences for working with inherited type clauses. NFC.
This commit is contained in:
Allan Shortlidge
2023-09-05 17:08:05 -07:00
parent 2c3c3c1933
commit 0dd8f4c492
33 changed files with 221 additions and 163 deletions

View File

@@ -620,17 +620,6 @@ SelfBounds getSelfBoundsFromWhereClause(
/// given protocol or protocol extension.
SelfBounds getSelfBoundsFromGenericSignature(const ExtensionDecl *extDecl);
/// Retrieve the TypeLoc at the given \c index from among the set of
/// type declarations that are directly "inherited" by the given declaration.
inline const TypeLoc &getInheritedTypeLocAtIndex(
llvm::PointerUnion<const TypeDecl *, const ExtensionDecl *> decl,
unsigned index) {
if (auto typeDecl = decl.dyn_cast<const TypeDecl *>())
return typeDecl->getInherited()[index];
return decl.get<const ExtensionDecl *>()->getInherited()[index];
}
namespace namelookup {
/// Searches through statements and patterns for local variable declarations.