Rightmost descendant-or-self named child of one of the given types.
(node: SyntaxNode, types: Set<string>)
| 598 | |
| 599 | /** Rightmost descendant-or-self named child of one of the given types. */ |
| 600 | function lastNamedOfType(node: SyntaxNode, types: Set<string>): SyntaxNode | null { |
| 601 | let found: SyntaxNode | null = null; |
| 602 | for (let i = 0; i < node.namedChildCount; i++) { |
| 603 | const child = node.namedChild(i); |
| 604 | if (!child) continue; |
| 605 | if (types.has(child.type)) found = child; |
| 606 | const deeper = lastNamedOfType(child, types); |
| 607 | if (deeper) found = deeper; |
| 608 | } |
| 609 | return found; |
| 610 | } |
| 611 | |
| 612 | function normalizeSpecial( |
| 613 | node: SyntaxNode, |