Legacy tag-based CFML: walk ` `/` `, delegating ` ` bodies.
()
| 145 | |
| 146 | /** Legacy tag-based CFML: walk `<cfcomponent>`/`<cffunction>`, delegating `<cfscript>` bodies. */ |
| 147 | private extractTagBased(): void { |
| 148 | const parser = getParser('cfml'); |
| 149 | if (!parser) { |
| 150 | this.errors.push({ |
| 151 | message: 'cfml grammar not loaded', |
| 152 | severity: 'error', |
| 153 | code: 'unsupported_language', |
| 154 | }); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | const tree = parser.parse(this.source); |
| 159 | if (!tree) { |
| 160 | this.errors.push({ |
| 161 | message: 'Failed to parse CFML source', |
| 162 | severity: 'error', |
| 163 | code: 'parse_error', |
| 164 | }); |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | try { |
| 169 | const fileNode = this.createFileNode(); |
| 170 | this.walkProgram(tree.rootNode, fileNode.id); |
| 171 | } finally { |
| 172 | // Trees hold wasm heap memory V8's GC never sees — free it per file. |
| 173 | tree.delete(); |
| 174 | } |
| 175 | this.extractTagExpressions(); |
| 176 | } |
| 177 | |
| 178 | /** Build the file's own `kind:'file'` node, spanning the whole source. Tag-based files need this explicitly — unlike `extractBareScript` (which delegates the whole file to `TreeSitterExtractor` and inherits its file node), `extractTagBased` walks the tree itself and has no other source of one. */ |
| 179 | private createFileNode(): Node { |
no test coverage detected