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

Function decode

hcldec/decode.go:11–28  ·  view source on GitHub ↗
(body hcl.Body, blockLabels []blockLabel, ctx *hcl.EvalContext, spec Spec, partial bool)

Source from the content-addressed store, hash-verified

9)
10
11func decode(body hcl.Body, blockLabels []blockLabel, ctx *hcl.EvalContext, spec Spec, partial bool) (cty.Value, hcl.Body, hcl.Diagnostics) {
12 schema := ImpliedSchema(spec)
13
14 var content *hcl.BodyContent
15 var diags hcl.Diagnostics
16 var leftovers hcl.Body
17
18 if partial {
19 content, leftovers, diags = body.PartialContent(schema)
20 } else {
21 content, diags = body.Content(schema)
22 }
23
24 val, valDiags := spec.decode(content, blockLabels, ctx)
25 diags = append(diags, valDiags...)
26
27 return val, leftovers, diags
28}
29
30func impliedType(spec Spec) cty.Type {
31 return spec.impliedType()

Callers 8

decodeMethod · 0.85
decodeMethod · 0.85
decodeMethod · 0.85
decodeMethod · 0.85
decodeMethod · 0.85
decodeMethod · 0.85
DecodeFunction · 0.85
PartialDecodeFunction · 0.85

Calls 4

ImpliedSchemaFunction · 0.85
PartialContentMethod · 0.65
ContentMethod · 0.65
decodeMethod · 0.65

Tested by

no test coverage detected