(&mut self, n: Node<'t>, decorated_row: u32)
| 1592 | } |
| 1593 | |
| 1594 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1595 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
| 1596 | return; |
| 1597 | } |
| 1598 | let mut target: Option<Node<'t>> = None; |
| 1599 | let mut cursor = n.walk(); |
| 1600 | let kids: Vec<Node<'t>> = n.named_children(&mut cursor).collect(); |
| 1601 | for child in kids { |
| 1602 | if child.kind() == "call_expression" { |
| 1603 | let fnn = child.child_by_field_name("function").or_else(|| child.named_child(0)); |
| 1604 | if let Some(f) = fnn { |
| 1605 | target = Some(f); |
| 1606 | } |
| 1607 | if target.is_some() { |
| 1608 | break; |
| 1609 | } |
| 1610 | } |
| 1611 | if matches!( |
| 1612 | child.kind(), |
| 1613 | "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression" |
| 1614 | | "user_type" | "type_identifier" |
| 1615 | ) { |
| 1616 | target = Some(child); |
| 1617 | break; |
| 1618 | } |
| 1619 | } |
| 1620 | let Some(target) = target else { return }; |
| 1621 | let mut name = self.text(target).to_string(); |
| 1622 | if let Some(lt) = name.find('<') { |
| 1623 | if lt > 0 { |
| 1624 | name.truncate(lt); |
| 1625 | } |
| 1626 | } |
| 1627 | let last_dot = name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 1628 | let last_colons = name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1); |
| 1629 | let last = last_dot.max(last_colons); |
| 1630 | if last >= 0 { |
| 1631 | name = name[(last as usize + 1)..].to_string(); |
| 1632 | name = name.trim_start_matches([':', '.']).to_string(); |
| 1633 | } |
| 1634 | let name = name.trim().to_string(); |
| 1635 | if name.is_empty() { |
| 1636 | return; |
| 1637 | } |
| 1638 | self.push_ref_at(decorated_row, &name, "decorates", n); |
| 1639 | } |
| 1640 | |
| 1641 | // --- extractInheritance — the dart rows (:5368-5393, :5437-5459) ------ |
| 1642 |
no test coverage detected