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

Method ForEachNamedChild

tree.go:352–359  ·  view source on GitHub ↗

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

(fn func(*Node))

Source from the content-addressed store, hash-verified

350// ForEachNamedChild iterates over a node's named children in a
351// depth-first manner, calling the supplied function for each node
352func (n *Node) ForEachNamedChild(fn func(*Node)) {
353 it := sitter.NewNamedIterator(n.node, sitter.DFSMode)
354
355 it.ForEach(func(sn *sitter.Node) error {
356 fn(NewNode(sn, n.source))
357 return nil
358 })
359}
360
361// Format outputs a nicely formatted version of the source code for the
362// Node. Formatting is done by https://github.com/ditashi/jsbeautifier-go/

Callers

nothing calls this directly

Calls 1

NewNodeFunction · 0.85

Tested by

no test coverage detected