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

Method Enter

hclsyntax/variables.go:36–57  ·  view source on GitHub ↗
(n Node)

Source from the content-addressed store, hash-verified

34}
35
36func (w *variablesWalker) Enter(n Node) hcl.Diagnostics {
37 switch tn := n.(type) {
38 case *ScopeTraversalExpr:
39 t := tn.Traversal
40
41 // Check if the given root name appears in any of the active
42 // local scopes. We don't want to return local variables here, since
43 // the goal of walking variables is to tell the calling application
44 // which names it needs to populate in the _root_ scope.
45 name := t.RootName()
46 for _, names := range w.localScopes {
47 if _, localized := names[name]; localized {
48 return nil
49 }
50 }
51
52 w.Callback(t)
53 case ChildScope:
54 w.localScopes = append(w.localScopes, tn.LocalNames)
55 }
56 return nil
57}
58
59func (w *variablesWalker) Exit(n Node) hcl.Diagnostics {
60 switch n.(type) {

Callers

nothing calls this directly

Calls 1

RootNameMethod · 0.45

Tested by

no test coverage detected