* Find first named child whose type is in the given list. * Used to locate inner type nodes (e.g. enum_specifier inside a typedef).
(node: SyntaxNode, types: string[])
| 1381 | * Used to locate inner type nodes (e.g. enum_specifier inside a typedef). |
| 1382 | */ |
| 1383 | private findChildByTypes(node: SyntaxNode, types: string[]): SyntaxNode | null { |
| 1384 | for (let i = 0; i < node.namedChildCount; i++) { |
| 1385 | const child = node.namedChild(i); |
| 1386 | if (child && types.includes(child.type)) return child; |
| 1387 | } |
| 1388 | return null; |
| 1389 | } |
| 1390 | |
| 1391 | /** |
| 1392 | * Find a `packageTypes` child under the root, create a `namespace` node |