Resolve the module_name node for a Python import_from_statement.
| 248 | |
| 249 | // Resolve the module_name node for a Python import_from_statement. |
| 250 | static TSNode resolve_py_module_node(TSNode node) { |
| 251 | TSNode module_node = ts_node_child_by_field_name(node, "module_name", FIELD_LEN_MODULE_NAME); |
| 252 | if (ts_node_is_null(module_node)) { |
| 253 | uint32_t nc = ts_node_child_count(node); |
| 254 | for (uint32_t j = 0; j < nc; j++) { |
| 255 | TSNode c = ts_node_child(node, j); |
| 256 | if (strcmp(ts_node_type(c), "dotted_name") == 0 || |
| 257 | strcmp(ts_node_type(c), "relative_import") == 0) { |
| 258 | return c; |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | return module_node; |
| 263 | } |
| 264 | |
| 265 | // Emit a Python import-from name child (identifier/dotted_name). |
| 266 | static void emit_py_import_from_name(CBMExtractCtx *ctx, TSNode child, const char *mod_path) { |
no outgoing calls
no test coverage detected