* 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)
| 232 | * function-pointer var) — return null so it isn't extracted as a variable. |
| 233 | */ |
| 234 | function cDeclaratorIdentifier(node: SyntaxNode | null): SyntaxNode | null { |
| 235 | let cur: SyntaxNode | null = node; |
| 236 | let guard = 0; |
| 237 | while (cur && guard++ < 12) { |
| 238 | switch (cur.type) { |
| 239 | case 'identifier': |
| 240 | return cur; |
| 241 | case 'function_declarator': |
| 242 | return null; |
| 243 | case 'init_declarator': |
| 244 | case 'pointer_declarator': |
| 245 | case 'array_declarator': |
| 246 | case 'parenthesized_declarator': |
| 247 | cur = getChildByField(cur, 'declarator'); |
| 248 | break; |
| 249 | default: |
| 250 | return null; |
| 251 | } |
| 252 | } |
| 253 | return null; |
| 254 | } |
| 255 | |
| 256 | /** First `simple_identifier` in `node`'s subtree (breadth-ish, first-found). |
| 257 | * Swift's property name nests as `property_declaration → <name> pattern → |
no test coverage detected