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