Skip to main content

Module visitor

Module visitor 

Source
Expand description

This module defines the AstVisitor trait and its associated macros. The AstVisitor trait provides a set of methods for traversing and visiting ASTs

Traits§

AstVisitor
The AstVisitor trait provides a set of methods for visiting different types of AST nodes. Implementors can individually override the methods they are interested in. When overriding a method, make sure to call walk on the visited statement to visit its children. DO NOT call walk on the node itself to avoid a recursion (last parameter). Implementors may also decide to not call the statement’s walk method to avoid visiting the children of the statement.
Walker
The Walker implements the traversal of the AST nodes and Ast-related objects (e.g. CompilationUnit). The walk method is called on the object to visit its children. If the object passed to a AstVisitor’s visit method implements the Walker trait, a call to the it’s walk function continues the visiting process on its children.