Find the source string node in an ES import_statement.
| 837 | |
| 838 | // Find the source string node in an ES import_statement. |
| 839 | static TSNode find_es_source_node(TSNode node) { |
| 840 | TSNode source_node = ts_node_child_by_field_name(node, TS_FIELD("source")); |
| 841 | if (ts_node_is_null(source_node)) { |
| 842 | uint32_t nc = ts_node_child_count(node); |
| 843 | for (int j = (int)nc - SKIP_ONE; j >= 0; j--) { |
| 844 | TSNode c = ts_node_child(node, (uint32_t)j); |
| 845 | const char *ck = ts_node_type(c); |
| 846 | if (strcmp(ck, "string") == 0 || strcmp(ck, "string_literal") == 0) { |
| 847 | return c; |
| 848 | } |
| 849 | } |
| 850 | } |
| 851 | return source_node; |
| 852 | } |
| 853 | |
| 854 | // Process named_imports: import {A, B as C} from "path". |
| 855 | static bool process_named_imports(CBMExtractCtx *ctx, TSNode sub, const char *path) { |
no outgoing calls
no test coverage detected