(node: SyntaxNode, source: string)
| 84 | } |
| 85 | |
| 86 | function extractCppReceiverType(node: SyntaxNode, source: string): string | undefined { |
| 87 | const declarator = getChildByField(node, 'declarator'); |
| 88 | if (!declarator) return undefined; |
| 89 | const qid = findDeclaratorQualifiedId(declarator); |
| 90 | if (!qid) return undefined; |
| 91 | const parts = getNodeText(qid, source).trim().split('::').filter(Boolean); |
| 92 | if (parts.length <= 1) return undefined; |
| 93 | // An out-of-line template method definition carries the class's template |
| 94 | // parameter list in the qualifier (`template<typename T> T Box<T>::get()`), |
| 95 | // but the class node is indexed as bare `Box` — strip `<…>` so the receiver |
| 96 | // matches it, the same normalization #1043 applies to base-class refs. |
| 97 | // Multi-line parameter lists otherwise leak whole `<…>` blocks (newlines |
| 98 | // included) into qualified_name, which can exceed NAME_MAX (#1286). |
| 99 | const receiver = stripCppTemplateArgs(parts.slice(0, -1).join('::')); |
| 100 | return receiver || undefined; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Built-in / non-class return types that can never be a method receiver. We |
nothing calls this directly
no test coverage detected