mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Scope map] Query the declarations introduced by a given AST scope.
Introduce an operation that produces the set of local declarations that are newly introduced by a given AST scope. This is a building block of unqualified name lookup, which walks upward in the tree (e.g., from children to parents) looking for declarations that have been made visible at each step.
This commit is contained in:
@@ -814,6 +814,20 @@ static bool performCompile(CompilerInstance &Instance,
|
||||
if (auto dc = locScope->getDeclContext()) {
|
||||
dc->printContext(llvm::errs());
|
||||
}
|
||||
|
||||
// Grab the local bindings introduced by this scope.
|
||||
auto localBindings = locScope->getLocalBindings();
|
||||
if (!localBindings.empty()) {
|
||||
llvm::errs() << "Local bindings: ";
|
||||
interleave(localBindings.begin(), localBindings.end(),
|
||||
[&](ValueDecl *value) {
|
||||
llvm::errs() << value->getFullName();
|
||||
},
|
||||
[&]() {
|
||||
llvm::errs() << " ";
|
||||
});
|
||||
llvm::errs() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
llvm::errs() << "***Complete scope map***\n";
|
||||
|
||||
Reference in New Issue
Block a user