Renovate name lookup to prepare for compound name lookup.

Make the name lookup interfaces all take DeclNames instead of identifiers, and update the lookup caches of the various file units to index their members by both compound name and simple name. Serialized modules are keyed by identifiers, so as a transitional hack, do simple name lookup then filter the results by compound name.

Swift SVN r14768
This commit is contained in:
Joe Groff
2014-03-07 03:21:29 +00:00
parent e60c59892b
commit 96c09d7179
17 changed files with 253 additions and 110 deletions

View File

@@ -276,16 +276,11 @@ bool SerializedASTFile::isSystemModule() const {
}
void SerializedASTFile::lookupValue(Module::AccessPathTy accessPath,
Identifier name, NLKind lookupKind,
DeclName name, NLKind lookupKind,
SmallVectorImpl<ValueDecl*> &results) const{
assert(accessPath.size() <= 1 && "can only refer to top-level decls");
// If this import is specific to some named type or decl
// ("import typealias Swift.Int"), then filter out any lookups that
// don't match.
if (accessPath.size() == 1 && accessPath.front().first != name)
if (!Module::matchesAccessPath(accessPath, name))
return;
File.lookupValue(name, results);
}
@@ -307,7 +302,7 @@ void SerializedASTFile::lookupClassMembers(Module::AccessPathTy accessPath,
void
SerializedASTFile::lookupClassMember(Module::AccessPathTy accessPath,
Identifier name,
DeclName name,
SmallVectorImpl<ValueDecl*> &decls) const {
File.lookupClassMember(accessPath, name, decls);
}