(&mut self, node: Node<'t>, class_row: u32)
| 2038 | // --- extractInheritance — the dart rows (:5368-5393, :5437-5459) ------ |
| 2039 | |
| 2040 | fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) { |
| 2041 | // The type an extension is `on` — a `references` edge (#2327). |
| 2042 | if node.kind() == "extension_declaration" { |
| 2043 | let mut oc = node.walk(); |
| 2044 | let on_types: Vec<Node<'t>> = node.children_by_field_name("class", &mut oc).collect(); |
| 2045 | for on_type in on_types { |
| 2046 | self.type_refs_dart(on_type, class_row); |
| 2047 | } |
| 2048 | } |
| 2049 | let mut cursor = node.walk(); |
| 2050 | let kids: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 2051 | for child in kids { |
| 2052 | if child.kind() == "mixin_application_class" { |
| 2053 | // `class A = B with M implements I;` — extends B, implements |
| 2054 | // each mixin and interface, in source order. |
| 2055 | let mut cc = child.walk(); |
| 2056 | let application = child.named_children(&mut cc).find(|c| c.kind() == "mixin_application"); |
| 2057 | let Some(application) = application else { continue }; |
| 2058 | let mut ac = application.walk(); |
| 2059 | let parts: Vec<Node<'t>> = application.named_children(&mut ac).collect(); |
| 2060 | for t in parts { |
| 2061 | match t.kind() { |
| 2062 | "type_identifier" => { |
| 2063 | let name = self.text(t).to_string(); |
| 2064 | self.push_ref_at(class_row, &name, "extends", t); |
| 2065 | } |
| 2066 | "mixins" | "interfaces" => { |
| 2067 | let mut mc = t.walk(); |
| 2068 | let targets: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 2069 | for m in targets { |
| 2070 | if t.kind() == "interfaces" || m.kind() == "type_identifier" { |
| 2071 | let name = self.text(m).to_string(); |
| 2072 | self.push_ref_at(class_row, &name, "implements", m); |
| 2073 | } |
| 2074 | } |
| 2075 | } |
| 2076 | _ => {} |
| 2077 | } |
| 2078 | } |
| 2079 | } else if child.kind() == "superclass" { |
| 2080 | // extends type + `with` mixins (implements) — dart branch. |
| 2081 | let mut cc = child.walk(); |
| 2082 | let targets: Vec<Node<'t>> = child.named_children(&mut cc).collect(); |
| 2083 | for t in targets { |
| 2084 | if t.kind() == "mixins" { |
| 2085 | let mut mc = t.walk(); |
| 2086 | let mixins: Vec<Node<'t>> = t.named_children(&mut mc).collect(); |
| 2087 | for m in mixins { |
| 2088 | if m.kind() == "type_identifier" { |
| 2089 | let name = self.text(m).to_string(); |
| 2090 | self.push_ref_at(class_row, &name, "implements", m); |
| 2091 | } |
| 2092 | } |
| 2093 | } else if t.kind() == "type_identifier" { |
| 2094 | let name = self.text(t).to_string(); |
| 2095 | self.push_ref_at(class_row, &name, "extends", t); |
| 2096 | } |
| 2097 | } |
no test coverage detected