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)
| 1514 | /// (constructor_invocation) → NOTHING. Runs for functions/methods/classes |
| 1515 | /// only (hook properties never call it). |
| 1516 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 1517 | for i in 0..decl.named_child_count() { |
| 1518 | let Some(child) = decl.named_child(i) else { continue }; |
| 1519 | self.consider_decorator(child, decorated_row); |
| 1520 | if child.kind() == "modifiers" { |
| 1521 | for j in 0..child.named_child_count() { |
| 1522 | if let Some(m) = child.named_child(j) { |
| 1523 | self.consider_decorator(m, decorated_row); |
| 1524 | } |
| 1525 | } |
| 1526 | } |
| 1527 | } |
| 1528 | let Some(parent) = decl.parent() else { return }; |
| 1529 | let decl_start = decl.start_byte(); |
| 1530 | let mut decl_idx: isize = -1; |
| 1531 | for i in 0..parent.named_child_count() { |
| 1532 | if let Some(sib) = parent.named_child(i) { |
| 1533 | if sib.start_byte() == decl_start { |
| 1534 | decl_idx = i as isize; |
| 1535 | break; |
| 1536 | } |
| 1537 | } |
| 1538 | } |
| 1539 | if decl_idx > 0 { |
| 1540 | let mut j = decl_idx - 1; |
| 1541 | while j >= 0 { |
| 1542 | let Some(sib) = parent.named_child(j as usize) else { |
| 1543 | j -= 1; |
| 1544 | continue; |
| 1545 | }; |
| 1546 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 1547 | break; |
| 1548 | } |
| 1549 | self.consider_decorator(sib, decorated_row); |
| 1550 | j -= 1; |
| 1551 | } |
| 1552 | } |
| 1553 | } |
| 1554 | |
| 1555 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1556 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected