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

Method Value

hclsyntax/expression.go:1107–1118  ·  hclsyntax/expression.go::IndexExpr.Value
(ctx *hcl.EvalContext)

Source from the content-addressed store, hash-verified

1105}
1106
1107func (e *IndexExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {
1108 var diags hcl.Diagnostics
1109 coll, collDiags := e.Collection.Value(ctx)
1110 key, keyDiags := e.Key.Value(ctx)
1111 diags = append(diags, collDiags...)
1112 diags = append(diags, keyDiags...)
1113
1114 val, indexDiags := hcl.Index(coll, key, &e.BracketRange)
1115 setDiagEvalContext(indexDiags, e, ctx)
1116 diags = append(diags, indexDiags...)
1117 return val, diags
1118}
1119
1120func (e *IndexExpr) Range() hcl.Range {
1121 return e.SrcRange

Callers

nothing calls this directly

Calls 2

setDiagEvalContextFunction · 0.85
ValueMethod · 0.65

Tested by

no test coverage detected