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)
| 795 | /// (python's `call` kind isn't `call_expression`, and `attribute` isn't in |
| 796 | /// the target-kind list — mirrored exactly). |
| 797 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 798 | for child in decl.named_children(&mut decl.walk()) { |
| 799 | self.consider_decorator(child, decorated_row); |
| 800 | } |
| 801 | // Walked back from the declaration itself. Finding its place first, by counting the |
| 802 | // parent's children from the start, cost each declaration as much as it has |
| 803 | // siblings before it: a file of twenty thousand took minutes. |
| 804 | let mut sibling = decl.prev_named_sibling(); |
| 805 | while let Some(sib) = sibling { |
| 806 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 807 | break; |
| 808 | } |
| 809 | self.consider_decorator(sib, decorated_row); |
| 810 | sibling = sib.prev_named_sibling(); |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 815 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected