(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr)
| 169 | } |
| 170 | |
| 171 | func celBind(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
| 172 | if !macroTargetMatchesNamespace(celNamespace, target) { |
| 173 | return nil, nil |
| 174 | } |
| 175 | varIdent := args[0] |
| 176 | varName := "" |
| 177 | switch varIdent.Kind() { |
| 178 | case ast.IdentKind: |
| 179 | varName = varIdent.AsIdent() |
| 180 | default: |
| 181 | return nil, mef.NewError(varIdent.ID(), "cel.bind() variable names must be simple identifiers") |
| 182 | } |
| 183 | varInit := args[1] |
| 184 | resultExpr := args[2] |
| 185 | return mef.NewComprehension( |
| 186 | mef.NewList(), |
| 187 | unusedIterVar, |
| 188 | varName, |
| 189 | varInit, |
| 190 | mef.NewLiteral(types.False), |
| 191 | mef.NewIdent(varName), |
| 192 | resultExpr, |
| 193 | ), nil |
| 194 | } |
| 195 | |
| 196 | func newDynamicBlock(slotExprs []interpreter.InterpretableV2, expr interpreter.InterpretableV2) interpreter.InterpretableV2 { |
| 197 | bs := &dynamicBlock{ |
nothing calls this directly
no test coverage detected