MCPcopy
hub / github.com/BishopFox/jsluice / ForEachChild

Method ForEachChild

tree.go:341–348  ·  view source on GitHub ↗

ForEachChild iterates over a node's children in a depth-first manner, calling the supplied function for each node

(fn func(*Node))

Source from the content-addressed store, hash-verified

339// ForEachChild iterates over a node's children in a depth-first
340// manner, calling the supplied function for each node
341func (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

Callers

nothing calls this directly

Calls 1

NewNodeFunction · 0.85

Tested by

no test coverage detected