First string_lit anywhere under an expression (source = "./modules/x").
(expr: SyntaxNode)
| 390 | |
| 391 | /** First string_lit anywhere under an expression (source = "./modules/x"). */ |
| 392 | function findStringLit(expr: SyntaxNode): SyntaxNode | null { |
| 393 | const queue: SyntaxNode[] = [expr]; |
| 394 | while (queue.length) { |
| 395 | const n = queue.shift()!; |
| 396 | if (n.type === 'string_lit') return n; |
| 397 | for (const c of n.namedChildren) { |
| 398 | if (c) queue.push(c); |
| 399 | } |
| 400 | } |
| 401 | return null; |
| 402 | } |
| 403 | |
| 404 | interface BlockDecl { |
| 405 | kind: 'class' | 'module' | 'variable' | 'namespace'; |
no test coverage detected