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

Method sourceRange

hcldec/spec.go:848–867  ·  view source on GitHub ↗
(content *hcl.BodyContent, blockLabels []blockLabel)

Source from the content-addressed store, hash-verified

846}
847
848func (s *BlockSetSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range {
849 // We return the source range of the _first_ block of the given type,
850 // since they are not guaranteed to form a contiguous range.
851
852 var childBlock *hcl.Block
853 for _, candidate := range content.Blocks {
854 if candidate.Type != s.TypeName {
855 continue
856 }
857
858 childBlock = candidate
859 break
860 }
861
862 if childBlock == nil {
863 return content.MissingItemRange
864 }
865
866 return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested)
867}
868
869// A BlockMapSpec is a Spec that produces a cty map of the results of
870// decoding all of the nested blocks of a given type, using a nested spec.

Callers

nothing calls this directly

Calls 2

sourceRangeFunction · 0.85
labelsForBlockFunction · 0.85

Tested by

no test coverage detected