* Stream every node of a kind one at a time (lazy) instead of materializing * them all like getNodesByKind. For unbounded kinds (`function`, * `method`) on a symbol-dense project the full array is gigabytes; the * dynamic-edge synthesizers only scan-and-filter, so they iterate to ke
(kind: NodeKind)
| 1054 | * memory O(1) in the node count rather than O(nodes) (#610). |
| 1055 | */ |
| 1056 | *iterateNodesByKind(kind: NodeKind): IterableIterator<Node> { |
| 1057 | // Fresh statement per call (not a cached one): an iterator holds an open |
| 1058 | // cursor, so a shared statement would conflict across overlapping scans. |
| 1059 | const stmt = this.db.prepare('SELECT * FROM nodes WHERE kind = ?'); |
| 1060 | for (const row of stmt.iterate(kind)) { |
| 1061 | yield rowToNode(row as NodeRow); |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | /** |
| 1066 | * Get all nodes in the database |