* Delegate a ` ... ` tag's SQL body to the `cfquery` grammar. * `#hash#` expressions inside the SQL (e.g. `#getCurrentUser().getId()#` in a * WHERE clause) are real CFML calls/references — tree-sitter-cfml's `cfquery` * grammar parses them structurally (same `call_expressio
(queryTag: SyntaxNode, parentId: string | undefined)
| 740 | * or contains-edges to merge. |
| 741 | */ |
| 742 | private delegateQueryTag(queryTag: SyntaxNode, parentId: string | undefined): void { |
| 743 | const content = queryTag.namedChildren.find((c: SyntaxNode) => c.type === 'cf_query_content'); |
| 744 | if (!content) return; |
| 745 | |
| 746 | const sql = this.source.substring(content.startIndex, content.endIndex); |
| 747 | const startLine = content.startPosition.row; |
| 748 | |
| 749 | const extractor = new TreeSitterExtractor(this.filePath, sql, 'cfquery'); |
| 750 | const result = extractor.extract(); |
| 751 | |
| 752 | const innerFileNodeId = result.nodes.find((n) => n.kind === 'file')?.id; |
| 753 | for (const ref of result.unresolvedReferences) { |
| 754 | ref.line += startLine; |
| 755 | ref.filePath = this.filePath; |
| 756 | ref.language = this.language; |
| 757 | if ((!ref.fromNodeId || ref.fromNodeId === innerFileNodeId) && parentId) ref.fromNodeId = parentId; |
| 758 | this.unresolvedReferences.push(ref); |
| 759 | } |
| 760 | this.addBlockErrors(result.errors, queryTag, 'cfquery', startLine); |
| 761 | } |
| 762 | |
| 763 | /** Read a `cf_attribute`'s value by name from a tag node's direct `cf_attribute`/`cf_tag_attributes` children. */ |
| 764 | private tagAttr(tag: SyntaxNode, attrName: string): string | undefined { |
no test coverage detected