ForExpr represents iteration constructs: tuple = [for i, v in list: upper(v) if i > 2] object = {for k, v in map: k => upper(v)} object_of_tuples = {for v in list: v.key: v...}
| 1373 | // object = {for k, v in map: k => upper(v)} |
| 1374 | // object_of_tuples = {for v in list: v.key: v...} |
| 1375 | type ForExpr struct { |
| 1376 | KeyVar string // empty if ignoring the key |
| 1377 | ValVar string |
| 1378 | |
| 1379 | CollExpr Expression |
| 1380 | |
| 1381 | KeyExpr Expression // nil when producing a tuple |
| 1382 | ValExpr Expression |
| 1383 | CondExpr Expression // null if no "if" clause is present |
| 1384 | |
| 1385 | Group bool // set if the ellipsis is used on the value in an object for |
| 1386 | |
| 1387 | SrcRange hcl.Range |
| 1388 | OpenRange hcl.Range |
| 1389 | CloseRange hcl.Range |
| 1390 | } |
| 1391 | |
| 1392 | func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { |
| 1393 | var diags hcl.Diagnostics |
nothing calls this directly
no outgoing calls
no test coverage detected