We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fafd457 commit 3dbe8c4Copy full SHA for 3dbe8c4
src/trees.rs
@@ -647,10 +647,13 @@ impl NodeIterator for PreorderNodeIterator<'_> {
647
self.current_node_ = self.node_stack.pop();
648
match self.current_node_ {
649
Some(u) => {
650
- let mut c = self.tree.left_child(u).unwrap();
+ // NOTE: process children right-to-left
651
+ // because we later pop them from a steck
652
+ // to generate the expected left-to-right ordering.
653
+ let mut c = self.tree.right_child(u).unwrap();
654
while c != NodeId::NULL {
655
self.node_stack.push(c);
- c = self.tree.right_sib(c).unwrap();
656
+ c = self.tree.left_sib(c).unwrap();
657
}
658
659
None => {
0 commit comments