(node: SyntaxNode | null)
| 14 | * function-pointer var) — return null so it isn't extracted as a variable. |
| 15 | */ |
| 16 | export 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 |
no test coverage detected