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

Function cDeclaratorIdentifier

src/extraction/languages/c-cpp.ts:13–33  ·  view source on GitHub ↗
(node: SyntaxNode | null)

Source from the content-addressed store, hash-verified

11 * function-pointer var) — return null so it isn't extracted as a variable.
12 */
13export function cDeclaratorIdentifier(node: SyntaxNode | null): SyntaxNode | null {
14 let cur: SyntaxNode | null = node;
15 let guard = 0;
16 while (cur && guard++ < 12) {
17 switch (cur.type) {
18 case 'identifier':
19 return cur;
20 case 'function_declarator':
21 return null;
22 case 'init_declarator':
23 case 'pointer_declarator':
24 case 'array_declarator':
25 case 'parenthesized_declarator':
26 cur = getChildByField(cur, 'declarator');
27 break;
28 default:
29 return null;
30 }
31 }
32 return null;
33}
34
35/**
36 * Whether a C or Objective-C declaration is a constant: a `const` or

Callers 3

flushValueRefsMethod · 0.90
extractVariableMethod · 0.90
unnamedTypeVariableNameFunction · 0.85

Calls 1

getChildByFieldFunction · 0.90

Tested by

no test coverage detected