Skip to content

Commit 037ef68

Browse files
rishipalcopybara-github
authored andcommitted
Fix incorrect documentation of NodeTraversal.Callback
PiperOrigin-RevId: 564534198
1 parent eb40aff commit 037ef68

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/com/google/javascript/jscomp/NodeTraversal.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,18 @@ public class NodeTraversal {
7878
/** Callback for tree-based traversals */
7979
public interface Callback {
8080
/**
81-
* Visits a node in preorder (before its children) and decides whether its children should be
82-
* traversed. If the children should be traversed, they will be visited by {@link
81+
* Visits a node in preorder (before its children) and decides whether the node and its children
82+
* should be traversed.
83+
*
84+
* <p>If this method returns true, the node will be visited by {@link #visit(NodeTraversal,
85+
* Node, Node)} in postorder and its children will be visited by both {@link
8386
* #shouldTraverse(NodeTraversal, Node, Node)} in preorder and by {@link #visit(NodeTraversal,
8487
* Node, Node)} in postorder.
8588
*
89+
* <p>If this method returns false, the node will not be visited by {@link #visit(NodeTraversal,
90+
* Node, Node)} and its children will neither be visited by {@link
91+
* #shouldTraverse(NodeTraversal, Node, Node)} nor {@link #visit(NodeTraversal, Node, Node)}.
92+
*
8693
* <p>Siblings are always visited left-to-right.
8794
*
8895
* <p>Implementations can have side-effects (e.g. modify the parse tree). Removing the current
@@ -98,8 +105,8 @@ public interface Callback {
98105

99106
/**
100107
* Visits a node in postorder (after its children). A node is visited in postorder iff {@link
101-
* #shouldTraverse(NodeTraversal, Node, Node)} returned true for its parent. In particular, the
102-
* root node is never visited in postorder.
108+
* #shouldTraverse(NodeTraversal, Node, Node)} returned true for its parent and itself. In
109+
* particular, the root node is never visited in postorder.
103110
*
104111
* <p>Siblings are always visited left-to-right.
105112
*

0 commit comments

Comments
 (0)