* The name of a C++ function an explicit specialization defines, without its * template arguments: `Swap` for `template <> void Swap (Foo& a, Foo& b)`. * Undefined for any other definition. Mirrored in the kernel (ccpp/mod.rs).
(node: SyntaxNode, source: string)
| 418 | * Undefined for any other definition. Mirrored in the kernel (ccpp/mod.rs). |
| 419 | */ |
| 420 | function cppSpecializedFunctionName(node: SyntaxNode, source: string): string | undefined { |
| 421 | if (node.type !== 'function_definition') return undefined; |
| 422 | let declarator = getChildByField(node, 'declarator'); |
| 423 | while (declarator && (declarator.type === 'pointer_declarator' || declarator.type === 'reference_declarator')) { |
| 424 | declarator = getChildByField(declarator, 'declarator') || declarator.namedChild(0); |
| 425 | } |
| 426 | if (declarator?.type !== 'function_declarator') return undefined; |
| 427 | const inner = getChildByField(declarator, 'declarator'); |
| 428 | return inner?.type === 'template_function' ? cppDefinedName(inner, source) : undefined; |
| 429 | } |
| 430 | |
| 431 | function extractCppReceiverType(node: SyntaxNode, source: string): string | undefined { |
| 432 | const declarator = getChildByField(node, 'declarator'); |
no test coverage detected