ASTWalker
Index
Constructors
Methods
Constructors
constructor
Returns default
Methods
traverse
Traverses the ast tree provided and invokes
callbacks.enterNode
/callbacks.exitNode
Parameters
ast: any
An AST Tree object hash or an array of nodes.
callbacks: any
An object hash containing a function for
enterNode
and / orexitNode
keys.
Returns void
ASTWalker - Provides a simple AST traversal utility that traverses all nodes / children regardless of type.
A callback object is provided in
traverse
which may contain two methodsenterNode
andexitNode
which are invoked with the current node and the parent node respectively when entering and exiting a given node.enterNode
may return a array of strings which provide a set of children keys to ignore.enterNode
may also return null to skip traversing children keys entirely.