Skip to content

Commit 5ee5dee

Browse files
author
David Ungar
authored
Merge pull request #27171 from davidungar/memberCount-fix
[NameLookup ASTScope] Ensure memberCount includes unparsed members
2 parents 258f372 + f184f75 commit 5ee5dee

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/swift/AST/DeclContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ class IterableDeclContext {
760760
void addMember(Decl *member, Decl *hint = nullptr);
761761

762762
/// See \c MemberCount
763-
unsigned getMemberCount() const { return MemberCount; }
763+
unsigned getMemberCount() const;
764764

765765
/// Check whether there are lazily-loaded members.
766766
bool hasLazyMembers() const {

lib/AST/DeclContext.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ bool IterableDeclContext::hasUnparsedMembers() const {
807807
return true;
808808
}
809809

810+
unsigned IterableDeclContext::getMemberCount() const {
811+
if (hasUnparsedMembers())
812+
loadAllMembers();
813+
return MemberCount;
814+
}
815+
810816
void IterableDeclContext::loadAllMembers() const {
811817
ASTContext &ctx = getASTContext();
812818

0 commit comments

Comments
 (0)