* The links of a Pascal chain of names and calls, head first, the calls' * arguments and dereferences left out (`Logger.TLog.Create().Write` → * Logger, TLog, Create, Write; `GetPanel(1).Series` → GetPanel, Series; * `a^.Copy` → a, Copy, as Delphi dereferences a pointer for a member * an
(node: SyntaxNode)
| 9812 | * parentheses, a generic type). |
| 9813 | */ |
| 9814 | private pascalChainLinks(node: SyntaxNode): string[] | null { |
| 9815 | const links: string[] = []; |
| 9816 | let n: SyntaxNode | null = node; |
| 9817 | while (n?.type === 'exprDot' || n?.type === 'exprCall' || |
| 9818 | (n?.type === 'exprUnary' && n.namedChild(n.namedChildCount - 1)?.type === 'kHat')) { |
| 9819 | if (n.type === 'exprDot') { |
| 9820 | const last = n.namedChild(n.namedChildCount - 1); |
| 9821 | if (last?.type !== 'identifier') return null; |
| 9822 | links.unshift(getNodeText(last, this.source)); |
| 9823 | } |
| 9824 | n = n.namedChild(0); |
| 9825 | } |
| 9826 | if (n?.type !== 'identifier') return null; |
| 9827 | links.unshift(getNodeText(n, this.source)); |
| 9828 | return links; |
| 9829 | } |
| 9830 | |
| 9831 | /** |
| 9832 | * Recursively visit a Pascal block/statement tree for call expressions. |
no test coverage detected