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

@@ -3801,9 +3801,9 @@ public:
/// Add all of the inherited entries to the result vector.
///
/// \returns the number of entries added.
size_t addInherited(ArrayRef<InheritedEntry> inheritedEntries,
size_t addInherited(InheritedTypes inheritedEntries,
SmallVectorImpl<TypeID> &result) {
for (const auto &inherited : inheritedEntries) {
for (const auto &inherited : inheritedEntries.getEntries()) {
assert(!inherited.getType() || !inherited.getType()->hasArchetype());
TypeID typeRef = S.addTypeRef(inherited.getType());
@@ -4218,7 +4218,7 @@ public:
proto->getInherited(), inheritedAndDependencyTypes);
// Separately collect inherited protocol types as dependencies.
for (auto element : proto->getInherited()) {
for (auto element : proto->getInherited().getEntries()) {
auto elementType = element.getType();
assert(!elementType || !elementType->hasArchetype());
if (elementType &&