Resolve the module_name node for a Python import_from_statement.
| 219 | |
| 220 | // Resolve the module_name node for a Python import_from_statement. |
| 221 | static TSNode resolve_py_module_node(TSNode node) { |
| 222 | TSNode module_node = ts_node_child_by_field_name(node, "module_name", FIELD_LEN_MODULE_NAME); |
| 223 | if (ts_node_is_null(module_node)) { |
| 224 | uint32_t nc = ts_node_child_count(node); |
| 225 | for (uint32_t j = 0; j < nc; j++) { |
| 226 | TSNode c = ts_node_child(node, j); |
| 227 | if (strcmp(ts_node_type(c), "dotted_name") == 0 || |
| 228 | strcmp(ts_node_type(c), "relative_import") == 0) { |
| 229 | return c; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | return module_node; |
| 234 | } |
| 235 | |
| 236 | // Emit a Python import-from name child (identifier/dotted_name). |
| 237 | static void emit_py_import_from_name(CBMExtractCtx *ctx, TSNode child, const char *mod_path) { |
no outgoing calls
no test coverage detected