Find the source string node in an ES import_statement.
| 320 | |
| 321 | // Find the source string node in an ES import_statement. |
| 322 | static TSNode find_es_source_node(TSNode node) { |
| 323 | TSNode source_node = ts_node_child_by_field_name(node, TS_FIELD("source")); |
| 324 | if (ts_node_is_null(source_node)) { |
| 325 | uint32_t nc = ts_node_child_count(node); |
| 326 | for (int j = (int)nc - SKIP_ONE; j >= 0; j--) { |
| 327 | TSNode c = ts_node_child(node, (uint32_t)j); |
| 328 | const char *ck = ts_node_type(c); |
| 329 | if (strcmp(ck, "string") == 0 || strcmp(ck, "string_literal") == 0) { |
| 330 | return c; |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | return source_node; |
| 335 | } |
| 336 | |
| 337 | // Process named_imports: import {A, B as C} from "path". |
| 338 | static bool process_named_imports(CBMExtractCtx *ctx, TSNode sub, const char *path) { |
no outgoing calls
no test coverage detected