(ctx *cel.OptimizerContext, a *ast.AST)
| 271 | } |
| 272 | |
| 273 | func (opt *identityOptimizer) Optimize(ctx *cel.OptimizerContext, a *ast.AST) *ast.AST { |
| 274 | opt.t.Helper() |
| 275 | // The copy method should effectively update all of the old macro refs with new ones that are |
| 276 | // identical, but renumbered. |
| 277 | main := ctx.CopyASTAndMetadata(a) |
| 278 | // The new AST call will create a parsed expression which will be type-checked by the static |
| 279 | // optimizer. The input and output expressions should be identical, though may vary by number |
| 280 | // though. |
| 281 | return ctx.NewAST(main) |
| 282 | } |
| 283 | |
| 284 | type testOptimizer struct { |
| 285 | t *testing.T |
nothing calls this directly
no test coverage detected