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

Method ExprMap

hcltest/mock.go:173–188  ·  view source on GitHub ↗

Implementation for hcl.ExprMap

()

Source from the content-addressed store, hash-verified

171
172// Implementation for hcl.ExprMap
173func (e mockExprLiteral) ExprMap() []hcl.KeyValuePair {
174 v := e.V
175 ty := v.Type()
176 if v.IsKnown() && !v.IsNull() && (ty.IsObjectType() || ty.IsMapType()) {
177 ret := make([]hcl.KeyValuePair, 0, v.LengthInt())
178 for it := v.ElementIterator(); it.Next(); {
179 k, v := it.Element()
180 ret = append(ret, hcl.KeyValuePair{
181 Key: MockExprLiteral(k),
182 Value: MockExprLiteral(v),
183 })
184 }
185 return ret
186 }
187 return nil
188}
189
190// MockExprVariable returns a hcl.Expression that evaluates to the value of
191// the variable with the given name.

Callers

nothing calls this directly

Calls 2

MockExprLiteralFunction · 0.85
TypeMethod · 0.45

Tested by

no test coverage detected