(&mut self, n: Node<'t>, decorated_row: u32)
| 1122 | } |
| 1123 | |
| 1124 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1125 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
| 1126 | return; |
| 1127 | } |
| 1128 | let mut target: Option<Node<'t>> = None; |
| 1129 | let mut cursor = n.walk(); |
| 1130 | let kids: Vec<Node<'t>> = n.named_children(&mut cursor).collect(); |
| 1131 | for child in kids { |
| 1132 | if child.kind() == "call_expression" { |
| 1133 | let fnn = child.child_by_field_name("function").or_else(|| child.named_child(0)); |
| 1134 | if let Some(f) = fnn { |
| 1135 | target = Some(f); |
| 1136 | } |
| 1137 | if target.is_some() { |
| 1138 | break; |
| 1139 | } |
| 1140 | } |
| 1141 | if matches!( |
| 1142 | child.kind(), |
| 1143 | "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression" |
| 1144 | | "user_type" | "type_identifier" |
| 1145 | ) { |
| 1146 | target = Some(child); |
| 1147 | break; |
| 1148 | } |
| 1149 | } |
| 1150 | let Some(target) = target else { return }; |
| 1151 | let mut name = self.text(target).to_string(); |
| 1152 | if let Some(lt) = name.find('<') { |
| 1153 | if lt > 0 { |
| 1154 | name.truncate(lt); |
| 1155 | } |
| 1156 | } |
| 1157 | let last_dot = name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 1158 | let last_colons = name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1); |
| 1159 | let last = last_dot.max(last_colons); |
| 1160 | if last >= 0 { |
| 1161 | name = name[(last as usize + 1)..].to_string(); |
| 1162 | name = name.trim_start_matches([':', '.']).to_string(); |
| 1163 | } |
| 1164 | let name = name.trim().to_string(); |
| 1165 | if name.is_empty() { |
| 1166 | return; |
| 1167 | } |
| 1168 | self.push_ref_at(decorated_row, &name, "decorates", n); |
| 1169 | } |
| 1170 | |
| 1171 | // --- extractInheritance — the dart rows (:5368-5393, :5437-5459) ------ |
| 1172 |
no test coverage detected