| 794 | /* ── Objective-C ───────────────────────────────────────────────── */ |
| 795 | |
| 796 | static void sig_objc_params(sig_ctx_t *c, TSNode node) { |
| 797 | /* Selector keywords are the method's direct `identifier` children: the |
| 798 | * first is the name, each later one labels the parameter after it. */ |
| 799 | uint32_t count = ts_node_child_count(node); |
| 800 | bool saw_name = false; |
| 801 | TSNode pending = {0}; |
| 802 | bool have_pending = false; |
| 803 | for (uint32_t i = 0; i < count; i++) { |
| 804 | TSNode ch = ts_node_child(node, i); |
| 805 | const char *k = ts_node_type(ch); |
| 806 | if (strcmp(k, "identifier") == 0) { |
| 807 | if (saw_name) { |
| 808 | pending = ch; |
| 809 | have_pending = true; |
| 810 | } |
| 811 | saw_name = true; |
| 812 | } else if (strcmp(k, "method_parameter") == 0) { |
| 813 | sig_entry_open(c); |
| 814 | if (have_pending) { |
| 815 | sig_label_node(c, pending); |
| 816 | } else { |
| 817 | sig_label(c, NULL, 0); |
| 818 | } |
| 819 | have_pending = false; |
| 820 | if (sig_writes_types(c)) { |
| 821 | TSNode mt = cbm_find_child_by_kind(ch, "method_type"); |
| 822 | TSNode tn = ts_node_is_null(mt) ? mt : cbm_find_child_by_kind(mt, "type_name"); |
| 823 | size_t before = c->len; |
| 824 | sig_type_tokens(c, ts_node_is_null(tn) ? mt : tn); |
| 825 | if (c->len == before) { |
| 826 | sig_raw(c, "?", 1); |
| 827 | } |
| 828 | } |
| 829 | sig_entry_close(c); |
| 830 | } else if (!ts_node_is_named(ch) && sig_node_text_is(c, ch, "...")) { |
| 831 | sig_entry_open(c); |
| 832 | sig_raw_str(c, sig_variadic_marker(c->lang)); |
| 833 | sig_entry_close(c); |
| 834 | } |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | /* ── Generic ───────────────────────────────────────────────────── */ |
| 839 |
no test coverage detected