Implementation for hcl.ExprMap
()
| 171 | |
| 172 | // Implementation for hcl.ExprMap |
| 173 | func (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. |
nothing calls this directly
no test coverage detected