Skip to content

Commit

Permalink
Add comment describing why Tree::Walker only traverse the array part.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcurtis committed Jul 24, 2010
1 parent e6247c2 commit 2bacb68
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Tree/Walker.nqp
Expand Up @@ -3,11 +3,17 @@
# $Id$

class Tree::Walker {

our multi sub walk (Tree::Walker $walker, Capture $node) {
# By default, just walk the children of $node.
walkChildren($walker, $node);
}

our multi sub walkChildren (Tree::Walker $walker, Capture $tree) {
# We walk only the array part of the Capture by default, because
# the attributes of PAST::Nodes, for example, can sometimes contain
# cycles. In addition, in general, attributes are not used
# for simple sub-trees.
my $index := 0;
my $len := pir::elements__iP($tree);
while ($index < $len) {
Expand Down

0 comments on commit 2bacb68

Please sign in to comment.