(&mut self, n: Node<'t>, decorated_row: u32)
| 1181 | } |
| 1182 | |
| 1183 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1184 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
| 1185 | return; |
| 1186 | } |
| 1187 | let mut target: Option<Node> = None; |
| 1188 | for i in 0..n.named_child_count() { |
| 1189 | let Some(child) = n.named_child(i) else { continue }; |
| 1190 | if child.kind() == "call_expression" { |
| 1191 | target = child.child_by_field_name("function").or_else(|| child.named_child(0)); |
| 1192 | if target.is_some() { |
| 1193 | break; |
| 1194 | } |
| 1195 | } |
| 1196 | if matches!( |
| 1197 | child.kind(), |
| 1198 | "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression" |
| 1199 | | "user_type" | "type_identifier" |
| 1200 | ) { |
| 1201 | target = Some(child); |
| 1202 | break; |
| 1203 | } |
| 1204 | } |
| 1205 | let Some(target) = target else { return }; |
| 1206 | let mut name = self.text(target).to_string(); |
| 1207 | if let Some(lt) = name.find('<') { |
| 1208 | if lt > 0 { |
| 1209 | name.truncate(lt); |
| 1210 | } |
| 1211 | } |
| 1212 | let last_dot = name |
| 1213 | .rfind('.') |
| 1214 | .map(|i| i as isize) |
| 1215 | .unwrap_or(-1) |
| 1216 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1217 | if last_dot >= 0 { |
| 1218 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1219 | if name.starts_with(':') || name.starts_with('.') { |
| 1220 | name.remove(0); |
| 1221 | } |
| 1222 | } |
| 1223 | let name = name.trim().to_string(); |
| 1224 | if name.is_empty() { |
| 1225 | return; |
| 1226 | } |
| 1227 | self.push_ref(decorated_row, &name, edge_kind_index("decorates").unwrap(), n); |
| 1228 | } |
| 1229 | |
| 1230 | // --- extractInheritance (TS/JS clauses) --------------------------------------------------- |
| 1231 |
no test coverage detected