[Type checker] Add "all members" request.

Introduce an "all members" request to compute all of the members of a
given iterable declaration context in stable order. This builds on ABI
members so that it will also include, e.g., type aliases synthesized
for associated types.
This commit is contained in:
Doug Gregor
2021-01-20 09:57:17 -08:00
parent a8f7f0d4e5
commit c4e265e280
6 changed files with 92 additions and 14 deletions

View File

@@ -766,6 +766,14 @@ ArrayRef<Decl *> IterableDeclContext::getABIMembers() const {
ArrayRef<Decl *>());
}
ArrayRef<Decl *> IterableDeclContext::getAllMembers() const {
ASTContext &ctx = getASTContext();
return evaluateOrDefault(
ctx.evaluator,
AllMembersRequest{const_cast<IterableDeclContext *>(this)},
ArrayRef<Decl *>());
}
void IterableDeclContext::addMemberPreservingSourceOrder(Decl *member) {
auto &SM = getASTContext().SourceMgr;