]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/hcl2/hcldec/variables.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / hcl2 / hcldec / variables.go
index 427b0d0e6205be1b08a362e474aa640fe86a010a..7662516cada3bf39477a13ac4deb0e9f5e69e92c 100644 (file)
@@ -15,20 +15,22 @@ import (
 // be incomplete, but that's assumed to be okay because the eventual call
 // to Decode will produce error diagnostics anyway.
 func Variables(body hcl.Body, spec Spec) []hcl.Traversal {
+       var vars []hcl.Traversal
        schema := ImpliedSchema(spec)
-
        content, _, _ := body.PartialContent(schema)
 
-       var vars []hcl.Traversal
-
        if vs, ok := spec.(specNeedingVariables); ok {
                vars = append(vars, vs.variablesNeeded(content)...)
        }
-       spec.visitSameBodyChildren(func(s Spec) {
+
+       var visitFn visitFunc
+       visitFn = func(s Spec) {
                if vs, ok := s.(specNeedingVariables); ok {
                        vars = append(vars, vs.variablesNeeded(content)...)
                }
-       })
+               s.visitSameBodyChildren(visitFn)
+       }
+       spec.visitSameBodyChildren(visitFn)
 
        return vars
 }