@@ -10,10 +10,6 @@ import "iter"
10
10
11
11
// Ancestors returns an iterator over the ancestors of n, starting with n.Parent.
12
12
//
13
- // Example:
14
- //
15
- // for ancestor := range n.Ancestors() { ... }
16
- //
17
13
// Mutating a Node or its parents while iterating may have unexpected results.
18
14
func (n * Node ) Ancestors () iter.Seq [* Node ] {
19
15
_ = n .Parent // eager nil check
@@ -27,10 +23,6 @@ func (n *Node) Ancestors() iter.Seq[*Node] {
27
23
// ChildNodes returns an iterator over the immediate children of n,
28
24
// starting with n.FirstChild.
29
25
//
30
- // Example:
31
- //
32
- // for child := range n.ChildNodes() { ... }
33
- //
34
26
// Mutating a Node or its children while iterating may have unexpected results.
35
27
func (n * Node ) ChildNodes () iter.Seq [* Node ] {
36
28
_ = n .FirstChild // eager nil check
@@ -45,16 +37,12 @@ func (n *Node) ChildNodes() iter.Seq[*Node] {
45
37
// Descendants returns an iterator over all nodes recursively beneath
46
38
// n, excluding n itself. Nodes are visited in depth-first preorder.
47
39
//
48
- // Example:
49
- //
50
- // for desc := range n.Descendants() { ... }
51
- //
52
40
// Mutating a Node or its descendants while iterating may have unexpected results.
53
41
func (n * Node ) Descendants () iter.Seq [* Node ] {
54
42
_ = n .FirstChild // eager nil check
55
43
56
44
return func (yield func (* Node ) bool ) {
57
- _ = n .descendants (yield )
45
+ n .descendants (yield )
58
46
}
59
47
}
60
48
0 commit comments