ScopedWalker

This class traverses the graph in a similar way as the IterativeGraphWalker, but with the added feature, that a ScopeManager is populated with the scope information of the current node. This way, we can call functions on the supplied scopeManager and emulate that we are currently in the scope of the "consumed" node in the callback. This can be useful for resolving declarations or other scope-related tasks.

Constructors

Link copied to clipboard
constructor(lang: LanguageFrontend<*, *>)
constructor(scopeManager: ScopeManager, strategy: (Node) -> Iterator<Node> = Strategy::AST_FORWARD)

Properties

Link copied to clipboard
lateinit var strategy: (Node) -> Iterator<Node>

Functions

Link copied to clipboard
Link copied to clipboard
fun iterate(root: Node)

Wraps IterativeGraphWalker to handle declaration scopes.

Link copied to clipboard
fun registerReplacement(from: Node, to: Node)
Link copied to clipboard

Tries to replace the old expression with a new one, given the parent.

Link copied to clipboard