mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user