MapMacroExpander expands the input call arguments into a comprehension that transforms each element in the input to produce an output list. There are two call patterns supported by map: .map( , ) .map( , , ) In the second fo
(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr)
| 266 | // In the second form only iterVar values which return true when provided to the predicate expression |
| 267 | // are transformed. |
| 268 | func MapMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *Error) { |
| 269 | ph, err := toParserHelper(meh) |
| 270 | if err != nil { |
| 271 | return nil, err |
| 272 | } |
| 273 | out, err := parser.MakeMap(ph, mustAdaptToExpr(target), mustAdaptToExprs(args)) |
| 274 | if err != nil { |
| 275 | return nil, err |
| 276 | } |
| 277 | return adaptToProto(out) |
| 278 | } |
| 279 | |
| 280 | // FilterMacroExpander expands the input call arguments into a comprehension which produces a list which contains |
| 281 | // only elements which match the provided predicate expression: |