(&mut self, node: Node<'t>, class_row: u32)
| 1641 | // --- extractInheritance — the dart rows (:5368-5393, :5437-5459) ------ |
| 1642 | |
| 1643 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 1644 | // The type an extension is `on` — a `references` edge (#2327). |
| 1645 | if node.kind() == "extension_declaration" { |
| 1646 | let mut oc = node.walk(); |
| 1647 | let on_types: Vec<Node<'t>> = node.children_by_field_name("class", &mut oc).collect(); |
| 1648 | for on_type in on_types { |
| 1649 | self.type_refs_dart(on_type, class_row); |
| 1650 | } |
| 1651 | } |
| 1652 | let mut cursor = node.walk(); |
| 1653 | let kids: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 1654 | for child in kids { |
| 1655 | if child.kind() == "mixin_application_class" { |
| 1656 | // `class A = B with M implements I;` — extends B, implements |
| 1657 | // each mixin and interface, in source order. |
| 1658 | let mut cc = child.walk(); |
| 1659 | let application = child.named_children(&mut cc).find(|c| c.kind() == "mixin_application"); |
| 1660 | let Some(application) = application else { continue }; |
| 1661 | let mut ac = application.walk(); |
| 1662 | let parts: Vec<Node<'t>> = application.named_children(&mut ac).collect(); |
| 1663 | for t in parts { |
| 1664 | match t.kind() { |
| 1665 | "type_identifier" => { |
| 1666 | let name = self.text(t).to_string(); |
| 1667 | self.push_ref_at(class_row, &name, "extends", t); |
| 1668 | } |
| 1669 | "mixins" | "interfaces" => { |
| 1670 | let mut mc = t.walk(); |
| 1671 | let targets: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 1672 | for m in targets { |
| 1673 | if t.kind() == "interfaces" || m.kind() == "type_identifier" { |
| 1674 | let name = self.text(m).to_string(); |
| 1675 | self.push_ref_at(class_row, &name, "implements", m); |
| 1676 | } |
| 1677 | } |
| 1678 | } |
| 1679 | _ => {} |
| 1680 | } |
| 1681 | } |
| 1682 | } else if child.kind() == "superclass" { |
| 1683 | // extends type + `with` mixins (implements) — dart branch. |
| 1684 | let mut cc = child.walk(); |
| 1685 | let targets: Vec<Node<'t>> = child.named_children(&mut cc).collect(); |
| 1686 | for t in targets { |
| 1687 | if t.kind() == "mixins" { |
| 1688 | let mut mc = t.walk(); |
| 1689 | let mixins: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 1690 | for m in mixins { |
| 1691 | if m.kind() == "type_identifier" { |
| 1692 | let name = self.text(m).to_string(); |
| 1693 | self.push_ref_at(class_row, &name, "implements", m); |
| 1694 | } |
| 1695 | } |
| 1696 | } else if t.kind() == "type_identifier" { |
| 1697 | let name = self.text(t).to_string(); |
| 1698 | self.push_ref_at(class_row, &name, "extends", t); |
| 1699 | } |
| 1700 | } |
no test coverage detected