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

Function isCppPureVirtualMethodDecl

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

Source from the content-addressed store, hash-verified

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