mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Remove MemberLookupTable::updateLookupTable()
This commit is contained in:
@@ -1192,10 +1192,6 @@ void LazyConformanceLoader::anchor() {}
|
|||||||
/// Lookup table used to store members of a nominal type (and its extensions)
|
/// Lookup table used to store members of a nominal type (and its extensions)
|
||||||
/// for fast retrieval.
|
/// for fast retrieval.
|
||||||
class swift::MemberLookupTable : public ASTAllocated<swift::MemberLookupTable> {
|
class swift::MemberLookupTable : public ASTAllocated<swift::MemberLookupTable> {
|
||||||
/// The last extension that was included within the member lookup table's
|
|
||||||
/// results.
|
|
||||||
ExtensionDecl *LastExtensionIncluded = nullptr;
|
|
||||||
|
|
||||||
/// The type of the internal lookup table.
|
/// The type of the internal lookup table.
|
||||||
typedef llvm::DenseMap<DeclName, llvm::TinyPtrVector<ValueDecl *>>
|
typedef llvm::DenseMap<DeclName, llvm::TinyPtrVector<ValueDecl *>>
|
||||||
LookupTable;
|
LookupTable;
|
||||||
@@ -1212,9 +1208,6 @@ public:
|
|||||||
/// Create a new member lookup table.
|
/// Create a new member lookup table.
|
||||||
explicit MemberLookupTable(ASTContext &ctx);
|
explicit MemberLookupTable(ASTContext &ctx);
|
||||||
|
|
||||||
/// Update a lookup table with members from newly-added extensions.
|
|
||||||
void updateLookupTable(NominalTypeDecl *nominal);
|
|
||||||
|
|
||||||
/// Add the given member to the lookup table.
|
/// Add the given member to the lookup table.
|
||||||
void addMember(Decl *members);
|
void addMember(Decl *members);
|
||||||
|
|
||||||
@@ -1250,12 +1243,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dump(llvm::raw_ostream &os) const {
|
void dump(llvm::raw_ostream &os) const {
|
||||||
os << "LastExtensionIncluded:\n";
|
|
||||||
if (LastExtensionIncluded)
|
|
||||||
LastExtensionIncluded->printContext(os, 2);
|
|
||||||
else
|
|
||||||
os << " nullptr\n";
|
|
||||||
|
|
||||||
os << "Lookup:\n ";
|
os << "Lookup:\n ";
|
||||||
for (auto &pair : Lookup) {
|
for (auto &pair : Lookup) {
|
||||||
pair.getFirst().print(os);
|
pair.getFirst().print(os);
|
||||||
@@ -1357,22 +1344,6 @@ void MemberLookupTable::addMembers(DeclRange members) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemberLookupTable::updateLookupTable(NominalTypeDecl *nominal) {
|
|
||||||
// If the last extension we included is the same as the last known extension,
|
|
||||||
// we're already up-to-date.
|
|
||||||
if (LastExtensionIncluded == nominal->LastExtension)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Add members from each of the extensions that we have not yet visited.
|
|
||||||
for (auto next = LastExtensionIncluded
|
|
||||||
? LastExtensionIncluded->NextExtension.getPointer()
|
|
||||||
: nominal->FirstExtension;
|
|
||||||
next;
|
|
||||||
(LastExtensionIncluded = next,next = next->NextExtension.getPointer())) {
|
|
||||||
addMembers(next->getMembers());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NominalTypeDecl::addedExtension(ExtensionDecl *ext) {
|
void NominalTypeDecl::addedExtension(ExtensionDecl *ext) {
|
||||||
auto *table = LookupTable.getPointer();
|
auto *table = LookupTable.getPointer();
|
||||||
|
|
||||||
@@ -1619,7 +1590,6 @@ DirectLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
for (auto E : decl->getExtensions())
|
for (auto E : decl->getExtensions())
|
||||||
(void)E->getMembers();
|
(void)E->getMembers();
|
||||||
|
|
||||||
Table.updateLookupTable(decl);
|
|
||||||
} else if (!Table.isLazilyComplete(name.getBaseName())) {
|
} else if (!Table.isLazilyComplete(name.getBaseName())) {
|
||||||
DeclBaseName baseName(name.getBaseName());
|
DeclBaseName baseName(name.getBaseName());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user