(&mut self, node: Node<'t>)
| 942 | // --- extractImport + binding refs --------------------------------------------------- |
| 943 | |
| 944 | pub(super) fn extract_import(&mut self, node: Node<'t>) { |
| 945 | let import_text = self.text(node).trim().to_string(); |
| 946 | // typescriptExtractor.extractImport: the `source` field, quotes stripped |
| 947 | // globally. A missing/empty module means the hook declined — no node. |
| 948 | let Some(source_field) = node.child_by_field_name("source") else { return }; |
| 949 | let module_name: String = self |
| 950 | .text(source_field) |
| 951 | .chars() |
| 952 | .filter(|c| *c != '\'' && *c != '"') |
| 953 | .collect(); |
| 954 | if module_name.is_empty() { |
| 955 | return; |
| 956 | } |
| 957 | self.create_node( |
| 958 | "import", |
| 959 | &module_name, |
| 960 | node, |
| 961 | Extra { signature: Some(import_text), ..Extra::default() }, |
| 962 | ); |
| 963 | let parent = self.top_row(); |
| 964 | self.push_ref(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node); |
| 965 | self.emit_import_binding_refs(node, parent); |
| 966 | } |
| 967 | |
| 968 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 969 | let clause = (0..node.named_child_count()) |
no test coverage detected