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

Function findDeclaratorQualifiedId

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

* Find the function NAME's `qualified_identifier` (`Foo::bar`) inside a * declarator, skipping the `parameter_list` — a parameter with a qualified type * (`const std::string& x`) must NOT be mistaken for the method name. Without the * skip, a plain free function `std::string TableFileName(const s

(declarator: SyntaxNode)

Source from the content-addressed store, hash-verified

11 * and its file looked like nothing depended on it.
12 */
13function findDeclaratorQualifiedId(declarator: SyntaxNode): SyntaxNode | undefined {
14 const queue: SyntaxNode[] = [declarator];
15 while (queue.length > 0) {
16 const current = queue.shift()!;
17 if (current.type === 'qualified_identifier') return current;
18 for (let i = 0; i < current.namedChildCount; i++) {
19 const child = current.namedChild(i);
20 // Don't descend into parameters or the trailing return type — their types
21 // (`const std::string&`, `-> std::string`) aren't the function name.
22 if (child && child.type !== 'parameter_list' && child.type !== 'trailing_return_type') {
23 queue.push(child);
24 }
25 }
26 }
27 return undefined;
28}
29
30/**
31 * Recover the real function name from the macro-definition idiom

Callers 2

extractCppReceiverTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected