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)
| 1164 | /// (constructor_invocation) → NOTHING. Runs for functions/methods/classes |
| 1165 | /// only (hook properties never call it). |
| 1166 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 1167 | for i in 0..decl.named_child_count() { |
| 1168 | let Some(child) = decl.named_child(i) else { continue }; |
| 1169 | self.consider_decorator(child, decorated_row); |
| 1170 | if child.kind() == "modifiers" { |
| 1171 | for j in 0..child.named_child_count() { |
| 1172 | if let Some(m) = child.named_child(j) { |
| 1173 | self.consider_decorator(m, decorated_row); |
| 1174 | } |
| 1175 | } |
| 1176 | } |
| 1177 | } |
| 1178 | let Some(parent) = decl.parent() else { return }; |
| 1179 | let decl_start = decl.start_byte(); |
| 1180 | let mut decl_idx: isize = -1; |
| 1181 | for i in 0..parent.named_child_count() { |
| 1182 | if let Some(sib) = parent.named_child(i) { |
| 1183 | if sib.start_byte() == decl_start { |
| 1184 | decl_idx = i as isize; |
| 1185 | break; |
| 1186 | } |
| 1187 | } |
| 1188 | } |
| 1189 | if decl_idx > 0 { |
| 1190 | let mut j = decl_idx - 1; |
| 1191 | while j >= 0 { |
| 1192 | let Some(sib) = parent.named_child(j as usize) else { |
| 1193 | j -= 1; |
| 1194 | continue; |
| 1195 | }; |
| 1196 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 1197 | break; |
| 1198 | } |
| 1199 | self.consider_decorator(sib, decorated_row); |
| 1200 | j -= 1; |
| 1201 | } |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1206 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected