ReleaseStatements returns a slice of statements back to their respective pools. Use this to clean up statements returned by ParseWithRecovery, which returns []Statement rather than an *AST. Example: stmts, errs := parser.ParseWithRecovery(tokens) defer ast.ReleaseStatements(stmts) // ... proces
(stmts []Statement)
| 489 | // defer ast.ReleaseStatements(stmts) |
| 490 | // // ... process stmts and errs ... |
| 491 | func ReleaseStatements(stmts []Statement) { |
| 492 | for i := range stmts { |
| 493 | if stmts[i] == nil { |
| 494 | continue |
| 495 | } |
| 496 | releaseStatement(stmts[i]) |
| 497 | stmts[i] = nil |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | // releaseStatement returns a single Statement to its pool. |
| 502 | // This is the central dispatch used by both ReleaseAST and ReleaseStatements. |