MCPcopy
hub / github.com/hashicorp/hcl / VisitAll

Function VisitAll

hclsyntax/walk.go:19–25  ·  view source on GitHub ↗

VisitAll is a basic way to traverse the AST beginning with a particular node. The given function will be called once for each AST node in depth-first order, but no context is provided about the shape of the tree. The VisitFunc may return diagnostics, in which case they will be accumulated and retur

(node Node, f VisitFunc)

Source from the content-addressed store, hash-verified

17// The VisitFunc may return diagnostics, in which case they will be accumulated
18// and returned as a single set.
19func VisitAll(node Node, f VisitFunc) hcl.Diagnostics {
20 diags := f(node)
21 node.walkChildNodes(func(node Node) {
22 diags = append(diags, VisitAll(node, f)...)
23 })
24 return diags
25}
26
27// Walker is an interface used with Walk.
28type Walker interface {

Callers

nothing calls this directly

Calls 1

walkChildNodesMethod · 0.65

Tested by

no test coverage detected