(node: SyntaxNode)
| 533 | * already mints the method node; pure virtuals never do (#1727). |
| 534 | */ |
| 535 | export 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` |
no test coverage detected