(ctx *cel.OptimizerContext, a *ast.AST)
| 287 | } |
| 288 | |
| 289 | func (opt *testOptimizer) Optimize(ctx *cel.OptimizerContext, a *ast.AST) *ast.AST { |
| 290 | opt.t.Helper() |
| 291 | copy := ctx.CopyASTAndMetadata(opt.inlineExpr) |
| 292 | origID := a.Expr().ID() |
| 293 | presenceTest, hasMacro := ctx.NewHasMacro(origID, copy) |
| 294 | macroKeys := getMacroKeys(ctx.MacroCalls()) |
| 295 | if len(macroKeys) != 2 { |
| 296 | opt.t.Errorf("Got %v macro calls, wanted 2", macroKeys) |
| 297 | } |
| 298 | ctx.UpdateExpr(a.Expr(), presenceTest) |
| 299 | ctx.SetMacroCall(origID, hasMacro) |
| 300 | return ctx.NewAST(a.Expr()) |
| 301 | } |
| 302 | |
| 303 | type replaceOptimizer struct { |
| 304 | t *testing.T |
nothing calls this directly
no test coverage detected