extractDecoratorsFor — Java annotations live inside `modifiers`.
(&mut self, decl: Node<'t>, decorated_row: u32)
| 1076 | |
| 1077 | /// extractDecoratorsFor — Java annotations live inside `modifiers`. |
| 1078 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 1079 | for child in decl.named_children(&mut decl.walk()) { |
| 1080 | self.consider_decorator(child, decorated_row); |
| 1081 | if child.kind() == "modifiers" { |
| 1082 | for m in child.named_children(&mut child.walk()) { |
| 1083 | self.consider_decorator(m, decorated_row); |
| 1084 | } |
| 1085 | } |
| 1086 | } |
| 1087 | // Preceding-sibling scan (TS-style class decorators) — Java annotations |
| 1088 | // are inside modifiers, so this is inert here; kept for parity of shape. |
| 1089 | // Walked back from the declaration itself. Finding its place first, by counting the |
| 1090 | // parent's children from the start, cost each declaration as much as it has |
| 1091 | // siblings before it: a file of twenty thousand took minutes. |
| 1092 | let mut sibling = decl.prev_named_sibling(); |
| 1093 | while let Some(sib) = sibling { |
| 1094 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 1095 | break; |
| 1096 | } |
| 1097 | self.consider_decorator(sib, decorated_row); |
| 1098 | sibling = sib.prev_named_sibling(); |
| 1099 | } |
| 1100 | } |
| 1101 | |
| 1102 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1103 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected