2445
// andAllChildren returns a sequence of all nodes in the tree starting from n, including n itself.
2446
// The sequence is depth-first, pre-order traversal.
2447
>
func (n *Node) andAllChildren() iter.Seq2[[]string, *Node] {
tree.go
2448
>
return func(yield func([]string, *Node) bool) {
2449
>
var walk func([]string, *Node) bool
2450
>
walk = func(path []string, node *Node) bool {
2451
>
if node == nil {
2452
return true
2453
}
2454
>
if !yield(path, node) {
tree.go
2455
return false
2456
}
2457
>
for _, child := range node.children {
tree.go
2458
childPath := make([]string, len(path)+1)
2459
copy(childPath, path)