Rightmost descendant-or-self named child of one of the given types.
(node: SyntaxNode, types: Set<string>)
| 624 | |
| 625 | /** Rightmost descendant-or-self named child of one of the given types. */ |
| 626 | function lastNamedOfType(node: SyntaxNode, types: Set<string>): SyntaxNode | null { |
| 627 | let found: SyntaxNode | null = null; |
| 628 | for (let i = 0; i < node.namedChildCount; i++) { |
| 629 | const child = node.namedChild(i); |
| 630 | if (!child) continue; |
| 631 | if (types.has(child.type)) found = child; |
| 632 | const deeper = lastNamedOfType(child, types); |
| 633 | if (deeper) found = deeper; |
| 634 | } |
| 635 | return found; |
| 636 | } |
| 637 | |
| 638 | function normalizeSpecial( |
| 639 | node: SyntaxNode, |