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