Swift source code is organized into a set of scopes, each of which can introduce names that can be found in that scope and other scopes nested within it. This project involves implementing a notion of lexical scopes to answer questions by introducing a new library for the swift-syntax package. These APIs can form the basis of IDE features like “Edit All in Scope” and are an important step toward replacing the C++ implementation of scopes within the Swift compiler.
At the current state, the Swift compiler has a class ASTScopeImpl
which essentially represents a lexical scope: