(rootNode: unknown)
| 419 | * there are no compound operators and hasBackslashEscapedOperator() can be skipped. |
| 420 | */ |
| 421 | export function hasActualOperatorNodes(rootNode: unknown): boolean { |
| 422 | const n = rootNode as TreeSitterNode |
| 423 | |
| 424 | function walk(node: TreeSitterNode): boolean { |
| 425 | // Check for operator types that indicate compound commands |
| 426 | if (node.type === ';' || node.type === '&&' || node.type === '||') { |
| 427 | // Verify this is a child of a list or program, not inside a command |
| 428 | return true |
| 429 | } |
| 430 | |
| 431 | if (node.type === 'list') { |
| 432 | // A list node means there are compound operators |
| 433 | return true |
| 434 | } |
| 435 | |
| 436 | for (const child of node.children) { |
| 437 | if (child && walk(child)) return true |
| 438 | } |
| 439 | return false |
| 440 | } |
| 441 | |
| 442 | return walk(n) |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * Extract dangerous pattern information from the AST. |
no test coverage detected