mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a :print_module directive to the REPL.
This is basically the same as doing a :print_decl on every decl in the module, except that it does not print extensions that come from other modules, and /does/ print extensions and operators that come from this module. Does not yet work for Clang modules or the Builtin module. Swift SVN r7601
This commit is contained in:
@@ -639,3 +639,29 @@ void ModuleFile::getLinkLibraries(Module::LinkLibraryCallback callback) const {
|
||||
for (auto &lib : LinkLibraries)
|
||||
callback(lib);
|
||||
}
|
||||
|
||||
void ModuleFile::getDisplayDecls(SmallVectorImpl<Decl *> &results) {
|
||||
if (OperatorDecls) {
|
||||
for (auto entry : make_range(OperatorDecls->data_begin(),
|
||||
OperatorDecls->data_end())) {
|
||||
for (auto item : entry)
|
||||
results.push_back(getDecl(item.second));
|
||||
}
|
||||
}
|
||||
|
||||
if (TopLevelDecls) {
|
||||
for (auto entry : make_range(TopLevelDecls->data_begin(),
|
||||
TopLevelDecls->data_end())) {
|
||||
for (auto item : entry)
|
||||
results.push_back(getDecl(item.second));
|
||||
}
|
||||
}
|
||||
|
||||
if (ExtensionDecls) {
|
||||
for (auto entry : make_range(ExtensionDecls->data_begin(),
|
||||
ExtensionDecls->data_end())) {
|
||||
for (auto item : entry)
|
||||
results.push_back(getDecl(item.second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user