DeclaredIdentifiersTrackingVisitor
open class DeclaredIdentifiersTrackingVisitor : ViolationsSyntaxVisitor
A specialized ViolationsSyntaxVisitor
that tracks declared identifiers per scope while traversing the AST.
-
A type that remembers the declared identifers (in order) up to the current position in the code.
Declaration
Swift
public typealias Scope = Stack<Set<String>>
-
The hierarchical stack of identifiers declared up to the current position in the code.
Declaration
Swift
public private(set) var scope: Scope { get }
-
Initializer.
Parameters
scope
A (potentially already pre-filled) scope to collect identifers into.
-
Indicate whether a given identifier is in scope.
Declaration
Swift
public func hasSeenDeclaration(for identifier: String) -> Bool
Parameters
identifier
An identifier.
-
Declaration
Swift
override open func visit(_ node: CodeBlockItemListSyntax) -> SyntaxVisitorContinueKind
-
Declaration
Swift
override open func visitPost(_ node: CodeBlockItemListSyntax)
-
Declaration
Swift
override open func visitPost(_ node: VariableDeclSyntax)
-
Declaration
Swift
override open func visitPost(_ node: GuardStmtSyntax)