extractDecoratorsFor — python decorators are PRECEDING SIBLINGS inside decorated_definition. Only bare-identifier decorators yield a target (python's `call` kind isn't `call_expression`, and `attribute` isn't in the target-kind list — mirrored exactly).
(&mut self, decl: Node<'t>, decorated_row: u32)
| 809 | /// (python's `call` kind isn't `call_expression`, and `attribute` isn't in |
| 810 | /// the target-kind list — mirrored exactly). |
| 811 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 812 | for i in 0..decl.named_child_count() { |
| 813 | if let Some(child) = decl.named_child(i) { |
| 814 | self.consider_decorator(child, decorated_row); |
| 815 | } |
| 816 | } |
| 817 | let Some(parent) = decl.parent() else { return }; |
| 818 | let decl_start = decl.start_byte(); |
| 819 | let mut decl_idx: isize = -1; |
| 820 | for i in 0..parent.named_child_count() { |
| 821 | if let Some(sib) = parent.named_child(i) { |
| 822 | if sib.start_byte() == decl_start { |
| 823 | decl_idx = i as isize; |
| 824 | break; |
| 825 | } |
| 826 | } |
| 827 | } |
| 828 | if decl_idx > 0 { |
| 829 | let mut j = decl_idx - 1; |
| 830 | while j >= 0 { |
| 831 | let Some(sib) = parent.named_child(j as usize) else { |
| 832 | j -= 1; |
| 833 | continue; |
| 834 | }; |
| 835 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 836 | break; |
| 837 | } |
| 838 | self.consider_decorator(sib, decorated_row); |
| 839 | j -= 1; |
| 840 | } |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 845 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected