MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Optimize

Method Optimize

cel/optimizer_test.go:273–282  ·  view source on GitHub ↗
(ctx *cel.OptimizerContext, a *ast.AST)

Source from the content-addressed store, hash-verified

271}
272
273func (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
284type testOptimizer struct {
285 t *testing.T

Callers

nothing calls this directly

Calls 2

CopyASTAndMetadataMethod · 0.80
NewASTMethod · 0.80

Tested by

no test coverage detected