ExtractASTs extracts non-nil ASTs from a slice of ParsedStatements. Empty statements (with nil AST) are skipped. Returns nil if no ASTs are found (preserves nil-check compatibility). This is useful for backward compatibility when migrating from []AST to []ParsedStatement.
(stmts []ParsedStatement)
| 72 | // Returns nil if no ASTs are found (preserves nil-check compatibility). |
| 73 | // This is useful for backward compatibility when migrating from []AST to []ParsedStatement. |
| 74 | func ExtractASTs(stmts []ParsedStatement) []AST { |
| 75 | var asts []AST |
| 76 | for _, stmt := range stmts { |
| 77 | if stmt.AST != nil { |
| 78 | asts = append(asts, stmt.AST) |
| 79 | } |
| 80 | } |
| 81 | return asts |
| 82 | } |
no outgoing calls