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

Method CopyASTAndMetadata

cel/optimizer.go:293–302  ·  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

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