MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / cppSpecializedFunctionName

Function cppSpecializedFunctionName

src/extraction/languages/c-cpp.ts:422–431  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

420 * Undefined for any other definition. Mirrored in the kernel (ccpp/mod.rs).
421 */
422function cppSpecializedFunctionName(node: SyntaxNode, source: string): string | undefined {
423 if (node.type !== 'function_definition') return undefined;
424 let declarator = getChildByField(node, 'declarator');
425 while (declarator && (declarator.type === 'pointer_declarator' || declarator.type === 'reference_declarator')) {
426 declarator = getChildByField(declarator, 'declarator') || declarator.namedChild(0);
427 }
428 if (declarator?.type !== 'function_declarator') return undefined;
429 const inner = getChildByField(declarator, 'declarator');
430 return inner?.type === 'template_function' ? cppDefinedName(inner, source) : undefined;
431}
432
433function extractCppReceiverType(node: SyntaxNode, source: string): string | undefined {
434 const declarator = getChildByField(node, 'declarator');

Callers 1

c-cpp.tsFile · 0.85

Calls 2

getChildByFieldFunction · 0.90
cppDefinedNameFunction · 0.85

Tested by

no test coverage detected