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

Function isCppPureVirtualMethodDecl

src/extraction/languages/c-cpp.ts:535–552  ·  view source on GitHub ↗
(node: SyntaxNode)

Source from the content-addressed store, hash-verified

533 * already mints the method node; pure virtuals never do (#1727).
534 */
535export function isCppPureVirtualMethodDecl(node: SyntaxNode): boolean {
536 if (node.type !== 'field_declaration') return false;
537 let declarator: SyntaxNode | null = getChildByField(node, 'declarator');
538 if (!declarator) return false;
539 while (
540 declarator.type === 'pointer_declarator' ||
541 declarator.type === 'reference_declarator'
542 ) {
543 const inner: SyntaxNode | null =
544 getChildByField(declarator, 'declarator') || declarator.namedChild(0);
545 if (!inner) return false;
546 declarator = inner;
547 }
548 if (declarator.type !== 'function_declarator') return false;
549 return node.namedChildren.some(
550 (c: SyntaxNode) => c.type === 'number_literal' && c.text === '0'
551 );
552}
553
554/**
555 * A function/method's return type lives in the `function_definition`'s `type`

Callers 1

c-cpp.tsFile · 0.85

Calls 1

getChildByFieldFunction · 0.90

Tested by

no test coverage detected