(&mut self, node: Node<'t>)
| 1521 | // --- extractImport + binding refs --------------------------------------------------- |
| 1522 | |
| 1523 | pub(super) fn extract_import(&mut self, node: Node<'t>) { |
| 1524 | let import_text = self.text(node).trim().to_string(); |
| 1525 | // typescriptExtractor.extractImport: the `source` field, quotes stripped |
| 1526 | // globally. A missing/empty module means the hook declined — no node. |
| 1527 | let Some(source_field) = node.child_by_field_name("source") else { return }; |
| 1528 | let module_name: String = self |
| 1529 | .text(source_field) |
| 1530 | .chars() |
| 1531 | .filter(|c| *c != '\'' && *c != '"') |
| 1532 | .collect(); |
| 1533 | if module_name.is_empty() { |
| 1534 | return; |
| 1535 | } |
| 1536 | self.create_node( |
| 1537 | "import", |
| 1538 | &module_name, |
| 1539 | node, |
| 1540 | Extra { signature: Some(import_text), ..Extra::default() }, |
| 1541 | ); |
| 1542 | let parent = self.top_row(); |
| 1543 | self.push_ref(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node); |
| 1544 | self.emit_import_binding_refs(node, parent); |
| 1545 | } |
| 1546 | |
| 1547 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 1548 | let clause = (0..node.named_child_count()) |
no test coverage detected