CopyASTAndMetadata copies the input AST and propagates the macro metadata into the AST being optimized.
(a *ast.AST)
| 292 | // CopyASTAndMetadata copies the input AST and propagates the macro metadata into the AST being |
| 293 | // optimized. |
| 294 | func (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. |
| 306 | func (opt *optimizerExprFactory) ClearMacroCall(id int64) { |