| 184 | /* ── Enclosing function detection ───────────────────────────────── */ |
| 185 | |
| 186 | static const char *enclosing_function_qn(CBMExtractCtx *ctx, TSNode node) { |
| 187 | TSNode parent = ts_node_parent(node); |
| 188 | while (!ts_node_is_null(parent)) { |
| 189 | const char *pk = ts_node_type(parent); |
| 190 | if (strcmp(pk, "function_declaration") == 0 || strcmp(pk, "method_definition") == 0 || |
| 191 | strcmp(pk, "arrow_function") == 0 || strcmp(pk, "function_expression") == 0 || |
| 192 | strcmp(pk, "function") == 0 || strcmp(pk, "method_signature") == 0 || |
| 193 | strcmp(pk, "function_definition") == 0 || strcmp(pk, "method_declaration") == 0 || |
| 194 | strcmp(pk, "function_item") == 0 || strcmp(pk, "def") == 0) { |
| 195 | TSNode name_node = ts_node_child_by_field_name(parent, TS_FIELD("name")); |
| 196 | if (!ts_node_is_null(name_node)) { |
| 197 | char *name = cbm_node_text(ctx->arena, name_node, ctx->source); |
| 198 | if (name && name[0]) { |
| 199 | return name; |
| 200 | } |
| 201 | } |
| 202 | return NULL; |
| 203 | } |
| 204 | parent = ts_node_parent(parent); |
| 205 | } |
| 206 | return NULL; |
| 207 | } |
| 208 | |
| 209 | /* ── Channel name extraction from arguments ──────────────────────── */ |
| 210 |
no test coverage detected