X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=vendor%2Fgithub.com%2Fhashicorp%2Fhcl2%2Fhcldec%2Fvariables.go;h=7662516cada3bf39477a13ac4deb0e9f5e69e92c;hb=b74d3065f299a1953e6d21e3d48d3ce0629bcaf7;hp=427b0d0e6205be1b08a362e474aa640fe86a010a;hpb=844b5a68d8af4791755b8f0ad293cc99f5959183;p=github%2Ffretlink%2Fterraform-provider-statuscake.git diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/variables.go b/vendor/github.com/hashicorp/hcl2/hcldec/variables.go index 427b0d0..7662516 100644 --- a/vendor/github.com/hashicorp/hcl2/hcldec/variables.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/variables.go @@ -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 }