(&mut self, node: Node<'t>)
| 1659 | // --- extractImport + binding refs --------------------------------------------------- |
| 1660 | |
| 1661 | pub(super) fn extract_import(&mut self, node: Node<'t>) { |
| 1662 | let import_text = self.text(node).trim().to_string(); |
| 1663 | // typescriptExtractor.extractImport: the `source` field, quotes stripped |
| 1664 | // globally. A missing/empty module means the hook declined — no node. |
| 1665 | let Some(source_field) = node.child_by_field_name("source") else { return }; |
| 1666 | let module_name: String = self |
| 1667 | .text(source_field) |
| 1668 | .chars() |
| 1669 | .filter(|c| *c != '\'' && *c != '"') |
| 1670 | .collect(); |
| 1671 | if module_name.is_empty() { |
| 1672 | return; |
| 1673 | } |
| 1674 | self.create_node( |
| 1675 | "import", |
| 1676 | &module_name, |
| 1677 | node, |
| 1678 | Extra { signature: Some(import_text), ..Extra::default() }, |
| 1679 | ); |
| 1680 | let parent = self.top_row(); |
| 1681 | self.push_ref(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node); |
| 1682 | self.emit_import_binding_refs(node, parent); |
| 1683 | } |
| 1684 | |
| 1685 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 1686 | let clause = (0..node.named_child_count()) |
no test coverage detected