(&mut self, node: Node<'t>)
| 2064 | // --- extractImport + binding refs --------------------------------------------------- |
| 2065 | |
| 2066 | pub(super) fn extract_import(&mut self, node: Node<'t>) { |
| 2067 | let import_text = self.text(node).trim().to_string(); |
| 2068 | // typescriptExtractor.extractImport: the `source` field, quotes stripped |
| 2069 | // globally. A missing/empty module means the hook declined — no node. |
| 2070 | let Some(source_field) = node.child_by_field_name("source") else { return }; |
| 2071 | let module_name: String = self |
| 2072 | .text(source_field) |
| 2073 | .chars() |
| 2074 | .filter(|c| *c != '\'' && *c != '"') |
| 2075 | .collect(); |
| 2076 | if module_name.is_empty() { |
| 2077 | return; |
| 2078 | } |
| 2079 | self.create_node( |
| 2080 | "import", |
| 2081 | &module_name, |
| 2082 | node, |
| 2083 | Extra { signature: Some(import_text), ..Extra::default() }, |
| 2084 | ); |
| 2085 | let parent = self.top_row(); |
| 2086 | self.push_ref(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node); |
| 2087 | self.emit_import_binding_refs(node, parent); |
| 2088 | } |
| 2089 | |
| 2090 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 2091 | let clause = (0..node.named_child_count()) |
no test coverage detected