ForEachChild iterates over a node's children in a depth-first manner, calling the supplied function for each node
(fn func(*Node))
| 339 | // ForEachChild iterates over a node's children in a depth-first |
| 340 | // manner, calling the supplied function for each node |
| 341 | func (n *Node) ForEachChild(fn func(*Node)) { |
| 342 | it := sitter.NewIterator(n.node, sitter.DFSMode) |
| 343 | |
| 344 | it.ForEach(func(sn *sitter.Node) error { |
| 345 | fn(NewNode(sn, n.source)) |
| 346 | return nil |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | // ForEachNamedChild iterates over a node's named children in a |
| 351 | // depth-first manner, calling the supplied function for each node |