* Resolve the declared identifier inside a C declarator. A `declaration`'s * `declarator` field nests the name through `init_declarator` (with value), * `pointer_declarator`/`array_declarator`/`parenthesized_declarator` * wrappers (each via their own `declarator` field) down to an `identifier`.
(node: SyntaxNode | null)
| 207 | * function-pointer var) — return null so it isn't extracted as a variable. |
| 208 | */ |
| 209 | function cDeclaratorIdentifier(node: SyntaxNode | null): SyntaxNode | null { |
| 210 | let cur: SyntaxNode | null = node; |
| 211 | let guard = 0; |
| 212 | while (cur && guard++ < 12) { |
| 213 | switch (cur.type) { |
| 214 | case 'identifier': |
| 215 | return cur; |
| 216 | case 'function_declarator': |
| 217 | return null; |
| 218 | case 'init_declarator': |
| 219 | case 'pointer_declarator': |
| 220 | case 'array_declarator': |
| 221 | case 'parenthesized_declarator': |
| 222 | cur = getChildByField(cur, 'declarator'); |
| 223 | break; |
| 224 | default: |
| 225 | return null; |
| 226 | } |
| 227 | } |
| 228 | return null; |
| 229 | } |
| 230 | |
| 231 | /** First `simple_identifier` in `node`'s subtree (breadth-ish, first-found). |
| 232 | * Swift's property name nests as `property_declaration → <name> pattern → |
no test coverage detected