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

Function cDeclaratorIdentifier

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

Source from the content-addressed store, hash-verified

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