(&mut self, node: Node<'t>)
| 1677 | // --- extractImport + binding refs --------------------------------------------------- |
| 1678 | |
| 1679 | pub(super) fn extract_import(&mut self, node: Node<'t>) { |
| 1680 | let import_text = self.text(node).trim().to_string(); |
| 1681 | // typescriptExtractor.extractImport: the `source` field, quotes stripped |
| 1682 | // globally. A missing/empty module means the hook declined — no node. |
| 1683 | let Some(source_field) = node.child_by_field_name("source") else { return }; |
| 1684 | let module_name: String = self |
| 1685 | .text(source_field) |
| 1686 | .chars() |
| 1687 | .filter(|c| *c != '\'' && *c != '"') |
| 1688 | .collect(); |
| 1689 | if module_name.is_empty() { |
| 1690 | return; |
| 1691 | } |
| 1692 | self.create_node( |
| 1693 | "import", |
| 1694 | &module_name, |
| 1695 | node, |
| 1696 | Extra { signature: Some(import_text), ..Extra::default() }, |
| 1697 | ); |
| 1698 | let parent = self.top_row(); |
| 1699 | self.push_ref(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node); |
| 1700 | self.emit_import_binding_refs(node, parent); |
| 1701 | } |
| 1702 | |
| 1703 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 1704 | let clause = (0..node.named_child_count()) |
no test coverage detected