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

Function cppSpecializedFunctionName

src/extraction/languages/c-cpp.ts:420–429  ·  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

418 * Undefined for any other definition. Mirrored in the kernel (ccpp/mod.rs).
419 */
420function 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
431function extractCppReceiverType(node: SyntaxNode, source: string): string | undefined {
432 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