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

Method CopyASTAndMetadata

cel/optimizer.go:294–303  ·  view source on GitHub ↗

CopyASTAndMetadata copies the input AST and propagates the macro metadata into the AST being optimized.

(a *ast.AST)

Source from the content-addressed store, hash-verified

292// CopyASTAndMetadata copies the input AST and propagates the macro metadata into the AST being
293// optimized.
294func (opt *optimizerExprFactory) CopyASTAndMetadata(a *ast.AST) ast.Expr {
295 copyExpr, copyInfo := opt.CopyAST(a)
296 for macroID, call := range copyInfo.MacroCalls() {
297 opt.SetMacroCall(macroID, call)
298 }
299 for id, offset := range copyInfo.OffsetRanges() {
300 opt.sourceInfo.SetOffsetRange(id, offset)
301 }
302 return copyExpr
303}
304
305// ClearMacroCall clears the macro at the given expression id.
306func (opt *optimizerExprFactory) ClearMacroCall(id int64) {

Callers 7

optimizeRuleMethod · 0.80
registerVariableMethod · 0.80
OptimizeMethod · 0.80
OptimizeMethod · 0.80
OptimizeMethod · 0.80
OptimizeMethod · 0.80

Calls 5

CopyASTMethod · 0.95
SetMacroCallMethod · 0.95
OffsetRangesMethod · 0.80
SetOffsetRangeMethod · 0.80
MacroCallsMethod · 0.45

Tested by 3

OptimizeMethod · 0.64
OptimizeMethod · 0.64
OptimizeMethod · 0.64