| 7437 | } |
| 7438 | |
| 7439 | void cbm_extract_definitions(CBMExtractCtx *ctx) { |
| 7440 | const CBMLangSpec *spec = cbm_lang_spec(ctx->language); |
| 7441 | if (!spec) { |
| 7442 | return; |
| 7443 | } |
| 7444 | |
| 7445 | CBMArena *a = ctx->arena; |
| 7446 | |
| 7447 | // Create module node (always first definition) |
| 7448 | CBMDefinition mod; |
| 7449 | memset(&mod, 0, sizeof(mod)); |
| 7450 | mod.name = ctx->rel_path; // will be refined by Go layer |
| 7451 | mod.qualified_name = ctx->module_qn; |
| 7452 | mod.label = "Module"; |
| 7453 | mod.file_path = ctx->rel_path; |
| 7454 | mod.start_line = FIRST_LINE; |
| 7455 | mod.end_line = ts_node_end_point(ctx->root).row + TS_LINE_OFFSET; |
| 7456 | mod.is_exported = true; |
| 7457 | mod.is_test = ctx->result->is_test_file; |
| 7458 | cbm_defs_push(&ctx->result->defs, a, mod); |
| 7459 | |
| 7460 | // Walk AST for function/class definitions |
| 7461 | walk_defs(ctx, ctx->root, spec, 0); |
| 7462 | |
| 7463 | // Extract module-level variables |
| 7464 | extract_variables(ctx, ctx->root, spec); |
| 7465 | } |
no test coverage detected