[Parse][CodeCompletion] Completions for precedencegroup decls

Added the 'Module::getPrecedenceGroups' API to separate precedence group lookup
from 'Module::lookupVisibleDecls', which together with 'FileUnit::lookupVisibleDecls',
to which the former is forwarded, are expected to look up only 'ValueDecl'. In particular, this
prevents completions like Module.PrecedenceGroup.
This commit is contained in:
fischertony
2018-06-30 08:15:14 +03:00
parent 261aca3008
commit e505d417fa
13 changed files with 380 additions and 36 deletions

View File

@@ -547,6 +547,20 @@ void SourceFile::getTopLevelDecls(SmallVectorImpl<Decl*> &Results) const {
Results.append(Decls.begin(), Decls.end());
}
void ModuleDecl::getPrecedenceGroups(
SmallVectorImpl<PrecedenceGroupDecl*> &Results) const {
FORWARD(getPrecedenceGroups, (Results));
}
void SourceFile::getPrecedenceGroups(
SmallVectorImpl<PrecedenceGroupDecl*> &Results) const {
for (auto pair : PrecedenceGroups) {
if (pair.second.getPointer() && pair.second.getInt()) {
Results.push_back(pair.second.getPointer());
}
}
}
void SourceFile::getLocalTypeDecls(SmallVectorImpl<TypeDecl*> &Results) const {
Results.append(LocalTypeDecls.begin(), LocalTypeDecls.end());
}