extractDecoratorsFor — kotlin annotations inside `modifiers`: `@Marker` (user_type child) → decorates ref; `@Anno(args)` (constructor_invocation) → NOTHING. Runs for functions/methods/classes only (hook properties never call it).
(&mut self, decl: Node<'t>, decorated_row: u32)
| 1559 | /// (constructor_invocation) → NOTHING. Runs for functions/methods/classes |
| 1560 | /// only (hook properties never call it). |
| 1561 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 1562 | for child in decl.named_children(&mut decl.walk()) { |
| 1563 | self.consider_decorator(child, decorated_row); |
| 1564 | if child.kind() == "modifiers" { |
| 1565 | for m in child.named_children(&mut child.walk()) { |
| 1566 | self.consider_decorator(m, decorated_row); |
| 1567 | } |
| 1568 | } |
| 1569 | } |
| 1570 | // Walked back from the declaration itself. Finding its place first, by counting the |
| 1571 | // parent's children from the start, cost each declaration as much as it has |
| 1572 | // siblings before it: a file of twenty thousand took minutes. |
| 1573 | let mut sibling = decl.prev_named_sibling(); |
| 1574 | while let Some(sib) = sibling { |
| 1575 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 1576 | break; |
| 1577 | } |
| 1578 | self.consider_decorator(sib, decorated_row); |
| 1579 | sibling = sib.prev_named_sibling(); |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1584 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected