(&mut self, node: Node<'t>, from_row: u32)
| 1545 | } |
| 1546 | |
| 1547 | fn emit_import_binding_refs(&mut self, node: Node<'t>, from_row: u32) { |
| 1548 | let clause = (0..node.named_child_count()) |
| 1549 | .filter_map(|i| node.named_child(i)) |
| 1550 | .find(|c| c.kind() == "import_clause"); |
| 1551 | let Some(clause) = clause else { return }; // side-effect import |
| 1552 | |
| 1553 | let imports_kind = edge_kind_index("imports").unwrap(); |
| 1554 | let push = |w: &mut Self, name_node: Option<Node>| { |
| 1555 | let Some(n) = name_node else { return }; |
| 1556 | let name = w.text(n).to_string(); |
| 1557 | if name.is_empty() { |
| 1558 | return; |
| 1559 | } |
| 1560 | w.push_ref(from_row, &name, imports_kind, n); |
| 1561 | }; |
| 1562 | |
| 1563 | for i in 0..clause.named_child_count() { |
| 1564 | let Some(child) = clause.named_child(i) else { continue }; |
| 1565 | match child.kind() { |
| 1566 | "identifier" => push(self, Some(child)), |
| 1567 | "named_imports" => { |
| 1568 | for j in 0..child.named_child_count() { |
| 1569 | let Some(spec) = child.named_child(j) else { continue }; |
| 1570 | if spec.kind() != "import_specifier" { |
| 1571 | continue; |
| 1572 | } |
| 1573 | let n = spec |
| 1574 | .child_by_field_name("alias") |
| 1575 | .or_else(|| spec.child_by_field_name("name")) |
| 1576 | .or_else(|| spec.named_child(0)); |
| 1577 | push(self, n); |
| 1578 | } |
| 1579 | } |
| 1580 | "namespace_import" => { |
| 1581 | let n = (0..child.named_child_count()) |
| 1582 | .filter_map(|k| child.named_child(k)) |
| 1583 | .find(|c| c.kind() == "identifier") |
| 1584 | .or_else(|| child.named_child(0)); |
| 1585 | push(self, n); |
| 1586 | } |
| 1587 | _ => {} |
| 1588 | } |
| 1589 | } |
| 1590 | } |
| 1591 | |
| 1592 | pub(super) fn emit_re_export_refs(&mut self, node: Node<'t>) { |
| 1593 | let from_row = self.top_row(); |
no test coverage detected