(e ast.ArrayExpr)
| 9 | ) |
| 10 | |
| 11 | func arrayExprExecutor(e ast.ArrayExpr) (expressionExecutor, error) { |
| 12 | return func(ctx context.Context, options *Options, data *model.Value) (*model.Value, error) { |
| 13 | ctx = WithExecutorID(ctx, "arrayExpr") |
| 14 | res := model.NewSliceValue() |
| 15 | |
| 16 | for _, expr := range e.Exprs { |
| 17 | el, err := ExecuteAST(ctx, expr, data, options) |
| 18 | if err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | |
| 22 | if el.IsSpread() { |
| 23 | if err := el.RangeSlice(func(_ int, value *model.Value) error { |
| 24 | if err := res.Append(value); err != nil { |
| 25 | return err |
| 26 | } |
| 27 | return nil |
| 28 | }); err != nil { |
| 29 | return nil, err |
| 30 | } |
| 31 | } else { |
| 32 | if err := res.Append(el); err != nil { |
| 33 | return nil, err |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return res, nil |
| 39 | }, nil |
| 40 | } |
| 41 | |
| 42 | func rangeExprExecutor(e ast.RangeExpr) (expressionExecutor, error) { |
| 43 | return func(ctx context.Context, options *Options, data *model.Value) (*model.Value, error) { |
no test coverage detected