| 298 | // --- Unified handlers --- |
| 299 | |
| 300 | void handle_throws(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec *spec, WalkState *state) { |
| 301 | bool has_throws = spec->throw_node_types && spec->throw_node_types[0]; |
| 302 | bool has_clause = spec->throws_clause_field && spec->throws_clause_field[0]; |
| 303 | if (!has_throws && !has_clause) { |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | if (has_throws && is_throw_node(node, spec)) { |
| 308 | char *exc_name = resolve_exception_name(ctx->arena, node, ctx->source); |
| 309 | if (exc_name && exc_name[0]) { |
| 310 | if (strlen(exc_name) > MAX_EXCEPTION_NAME_LEN) { |
| 311 | exc_name[MAX_EXCEPTION_NAME_LEN] = '\0'; |
| 312 | } |
| 313 | CBMThrow thr; |
| 314 | thr.exception_name = exc_name; |
| 315 | thr.enclosing_func_qn = state->enclosing_func_qn; |
| 316 | cbm_throws_push(&ctx->result->throws, ctx->arena, thr); |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | extract_throws_clause(ctx, node, spec, state->enclosing_func_qn); |
| 321 | } |
| 322 | |
| 323 | void handle_readwrites(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec *spec, WalkState *state) { |
| 324 | if (!spec->assignment_node_types || !spec->assignment_node_types[0]) { |
no test coverage detected