class documentation
This enumeration contains the different times an extension is used.
- Attributes:
- BEFORE: For each node, before calling the visit() method on the customizable visitor.
- ..note:: The depart() method will be called AFTER calling depart() on
- the customizable visitor. Outer scope.
- AFTER: For each node, before calling the visit(), and before the children gets visited.
- ..note:: The depart() method will be called after the children have been visited,
- and BEFORE calling depart() on the customizable visitor. Inner scope.
- Example:
Considering that the customizable visitor
MainVisitor
is set up with two extension visitors: one that runsBEFORE
and one that runsAFTER
, all 3 visitors simply print the name of the visitor class and the call beeing made.Running the
MainVisitor
on the following tree::0 - Module: a | :1 - Indirection: Union
Will generate the following output:
Before .visit(a) MainVistor .visit(a) After .visit(a) Before .visit(a.Union) MainVistor .visit(a.Union) After .visit(a.Union) After .depart(a.Union) MainVistor .depart(a.Union) Before .depart(a.Union) After .depart(a) MainVistor .depart(a) Before .depart(a)