| 1184 | } |
| 1185 | |
| 1186 | void cbm_extract_unified(CBMExtractCtx *ctx) { |
| 1187 | const CBMLangSpec *spec = cbm_lang_spec(ctx->language); |
| 1188 | if (!spec) { |
| 1189 | return; |
| 1190 | } |
| 1191 | |
| 1192 | TSTreeCursor cursor = ts_tree_cursor_new(ctx->root); |
| 1193 | WalkState state; |
| 1194 | memset(&state, 0, sizeof(state)); |
| 1195 | |
| 1196 | uint32_t depth = 0; |
| 1197 | |
| 1198 | for (;;) { |
| 1199 | TSNode node = ts_tree_cursor_current_node(&cursor); |
| 1200 | |
| 1201 | pop_expired_scopes(&state, depth); |
| 1202 | recompute_state(&state, ctx->module_qn); |
| 1203 | |
| 1204 | handle_string_constants(ctx, node, &state); |
| 1205 | handle_calls(ctx, node, spec, &state); |
| 1206 | handle_usages(ctx, node, spec, &state); |
| 1207 | handle_throws(ctx, node, spec, &state); |
| 1208 | handle_readwrites(ctx, node, spec, &state); |
| 1209 | handle_type_refs(ctx, node, spec, &state); |
| 1210 | handle_env_accesses(ctx, node, spec, &state); |
| 1211 | handle_type_assigns(ctx, node, spec, &state); |
| 1212 | handle_string_refs(ctx, node, &state); |
| 1213 | handle_yaml_nested(ctx, node); |
| 1214 | scan_infra_bindings(ctx, node); |
| 1215 | |
| 1216 | push_boundary_scopes(ctx, node, spec, &state, depth); |
| 1217 | |
| 1218 | if (ts_tree_cursor_goto_first_child(&cursor)) { |
| 1219 | depth++; |
| 1220 | continue; |
| 1221 | } |
| 1222 | if (ts_tree_cursor_goto_next_sibling(&cursor)) { |
| 1223 | continue; |
| 1224 | } |
| 1225 | bool found = false; |
| 1226 | while (ts_tree_cursor_goto_parent(&cursor)) { |
| 1227 | depth--; |
| 1228 | if (ts_tree_cursor_goto_next_sibling(&cursor)) { |
| 1229 | found = true; |
| 1230 | break; |
| 1231 | } |
| 1232 | } |
| 1233 | if (!found) { |
| 1234 | break; |
| 1235 | } |
| 1236 | } |
| 1237 | |
| 1238 | ts_tree_cursor_delete(&cursor); |
| 1239 | } |
no test coverage detected