The function_declarator of a C-family definition/declaration, looking * through (nested) template_declarations and pointer/reference return * declarators. */
| 374 | * through (nested) template_declarations and pointer/reference return |
| 375 | * declarators. */ |
| 376 | static TSNode sig_c_function_declarator(TSNode node) { |
| 377 | TSNode cur = node; |
| 378 | for (int depth = 0; depth < SIG_DECL_DEPTH && !ts_node_is_null(cur) && |
| 379 | strcmp(ts_node_type(cur), "template_declaration") == 0; |
| 380 | depth++) { |
| 381 | TSNode inner = {0}; |
| 382 | uint32_t count = ts_node_named_child_count(cur); |
| 383 | for (uint32_t i = 0; i < count && ts_node_is_null(inner); i++) { |
| 384 | TSNode ch = ts_node_named_child(cur, i); |
| 385 | if (sig_is_c_decl_kind(ts_node_type(ch))) { |
| 386 | inner = ch; |
| 387 | } |
| 388 | } |
| 389 | cur = inner; |
| 390 | } |
| 391 | for (int depth = 0; depth < SIG_DECL_DEPTH && !ts_node_is_null(cur); depth++) { |
| 392 | if (strcmp(ts_node_type(cur), "function_declarator") == 0) { |
| 393 | return cur; |
| 394 | } |
| 395 | cur = sig_c_inner_declarator(cur); |
| 396 | } |
| 397 | return (TSNode){0}; |
| 398 | } |
| 399 | |
| 400 | static void sig_c_qualifiers(sig_ctx_t *c, TSNode n) { |
| 401 | uint32_t count = ts_node_named_child_count(n); |
no test coverage detected