(&mut self, node: Node<'t>, class_row: u32)
| 2017 | // --- extractInheritance — the dart rows (:5368-5393, :5437-5459) ------ |
| 2018 | |
| 2019 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 2020 | // The type an extension is `on` — a `references` edge (#2327). |
| 2021 | if node.kind() == "extension_declaration" { |
| 2022 | let mut oc = node.walk(); |
| 2023 | let on_types: Vec<Node<'t>> = node.children_by_field_name("class", &mut oc).collect(); |
| 2024 | for on_type in on_types { |
| 2025 | self.type_refs_dart(on_type, class_row); |
| 2026 | } |
| 2027 | } |
| 2028 | let mut cursor = node.walk(); |
| 2029 | let kids: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 2030 | for child in kids { |
| 2031 | if child.kind() == "mixin_application_class" { |
| 2032 | // `class A = B with M implements I;` — extends B, implements |
| 2033 | // each mixin and interface, in source order. |
| 2034 | let mut cc = child.walk(); |
| 2035 | let application = child.named_children(&mut cc).find(|c| c.kind() == "mixin_application"); |
| 2036 | let Some(application) = application else { continue }; |
| 2037 | let mut ac = application.walk(); |
| 2038 | let parts: Vec<Node<'t>> = application.named_children(&mut ac).collect(); |
| 2039 | for t in parts { |
| 2040 | match t.kind() { |
| 2041 | "type_identifier" => { |
| 2042 | let name = self.text(t).to_string(); |
| 2043 | self.push_ref_at(class_row, &name, "extends", t); |
| 2044 | } |
| 2045 | "mixins" | "interfaces" => { |
| 2046 | let mut mc = t.walk(); |
| 2047 | let targets: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 2048 | for m in targets { |
| 2049 | if t.kind() == "interfaces" || m.kind() == "type_identifier" { |
| 2050 | let name = self.text(m).to_string(); |
| 2051 | self.push_ref_at(class_row, &name, "implements", m); |
| 2052 | } |
| 2053 | } |
| 2054 | } |
| 2055 | _ => {} |
| 2056 | } |
| 2057 | } |
| 2058 | } else if child.kind() == "superclass" { |
| 2059 | // extends type + `with` mixins (implements) — dart branch. |
| 2060 | let mut cc = child.walk(); |
| 2061 | let targets: Vec<Node<'t>> = child.named_children(&mut cc).collect(); |
| 2062 | for t in targets { |
| 2063 | if t.kind() == "mixins" { |
| 2064 | let mut mc = t.walk(); |
| 2065 | let mixins: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 2066 | for m in mixins { |
| 2067 | if m.kind() == "type_identifier" { |
| 2068 | let name = self.text(m).to_string(); |
| 2069 | self.push_ref_at(class_row, &name, "implements", m); |
| 2070 | } |
| 2071 | } |
| 2072 | } else if t.kind() == "type_identifier" { |
| 2073 | let name = self.text(t).to_string(); |
| 2074 | self.push_ref_at(class_row, &name, "extends", t); |
| 2075 | } |
| 2076 | } |
no test coverage detected