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

Method fixupContent

ext/dynblock/unknown_body.go:77–90  ·  view source on GitHub ↗
(got *hcl.BodyContent)

Source from the content-addressed store, hash-verified

75}
76
77func (b unknownBody) fixupContent(got *hcl.BodyContent) *hcl.BodyContent {
78 ret := &hcl.BodyContent{}
79 ret.Attributes = b.fixupAttrs(got.Attributes)
80 if len(got.Blocks) > 0 {
81 ret.Blocks = make(hcl.Blocks, 0, len(got.Blocks))
82 for _, gotBlock := range got.Blocks {
83 new := *gotBlock // shallow copy
84 new.Body = unknownBody{template: gotBlock.Body, valueMarks: b.valueMarks} // nested content must also be marked unknown
85 ret.Blocks = append(ret.Blocks, &new)
86 }
87 }
88
89 return ret
90}
91
92func (b unknownBody) fixupAttrs(got hcl.Attributes) hcl.Attributes {
93 if len(got) == 0 {

Callers 2

ContentMethod · 0.95
PartialContentMethod · 0.95

Calls 1

fixupAttrsMethod · 0.95

Tested by

no test coverage detected