Add direct operator lookup requests

Introduce DirectOperatorLookupRequest &
DirectPrecedenceGroupLookupRequest that lookup
operator and precedence groups within a given
file or module without looking through imports.

These will eventually be used as the basis for the
new operator lookup implementation, but for now
just use them when querying lookup results from
serialized module files.
This commit is contained in:
Hamish Knight
2020-03-22 14:20:57 -07:00
parent 9656a0491e
commit cc9c851856
7 changed files with 211 additions and 55 deletions

View File

@@ -1084,14 +1084,17 @@ SerializedASTFile::lookupNestedType(Identifier name,
return File.lookupNestedType(name, parent);
}
OperatorDecl *SerializedASTFile::lookupOperator(Identifier name,
OperatorFixity fixity) const {
return File.lookupOperator(name, fixity);
void SerializedASTFile::lookupOperatorDirect(
Identifier name, OperatorFixity fixity,
TinyPtrVector<OperatorDecl *> &results) const {
if (auto *op = File.lookupOperator(name, fixity))
results.push_back(op);
}
PrecedenceGroupDecl *
SerializedASTFile::lookupPrecedenceGroup(Identifier name) const {
return File.lookupPrecedenceGroup(name);
void SerializedASTFile::lookupPrecedenceGroupDirect(
Identifier name, TinyPtrVector<PrecedenceGroupDecl *> &results) const {
if (auto *group = File.lookupPrecedenceGroup(name))
results.push_back(group);
}
void SerializedASTFile::lookupVisibleDecls(ModuleDecl::AccessPathTy accessPath,