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

Method sourceRange

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

Source from the content-addressed store, hash-verified

686}
687
688func (s *BlockTupleSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range {
689 // We return the source range of the _first_ block of the given type,
690 // since they are not guaranteed to form a contiguous range.
691
692 var childBlock *hcl.Block
693 for _, candidate := range content.Blocks {
694 if candidate.Type != s.TypeName {
695 continue
696 }
697
698 childBlock = candidate
699 break
700 }
701
702 if childBlock == nil {
703 return content.MissingItemRange
704 }
705
706 return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested)
707}
708
709// A BlockSetSpec is a Spec that produces a cty set of the results of
710// 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