(&mut self, decl: Node<'t>, decorated_row: u32)
| 1082 | // --- extractDecoratorsFor (:4897-5024) — the sibling scan ------------- |
| 1083 | |
| 1084 | fn extract_decorators_for(&mut self, decl: Node<'t>, decorated_row: u32) { |
| 1085 | // Scan 1: direct children (+ modifiers descent) — inert for dart |
| 1086 | // (annotations are preceding siblings), ported for fidelity. |
| 1087 | let mut cursor = decl.walk(); |
| 1088 | let kids: Vec<Node<'t>> = decl.named_children(&mut cursor).collect(); |
| 1089 | for child in kids { |
| 1090 | self.consider_decorator(child, decorated_row); |
| 1091 | if child.kind() == "modifiers" { |
| 1092 | let mut mc = child.walk(); |
| 1093 | let inner: Vec<Node<'t>> = child.named_children(&mut mc).collect(); |
| 1094 | for m in inner { |
| 1095 | self.consider_decorator(m, decorated_row); |
| 1096 | } |
| 1097 | } |
| 1098 | } |
| 1099 | // Scan 2: preceding siblings, backward, stop at the first |
| 1100 | // non-annotation — stacked annotations emit in REVERSE source order. |
| 1101 | if let Some(parent) = decl.parent() { |
| 1102 | let decl_start = decl.start_byte(); |
| 1103 | let mut decl_idx: Option<usize> = None; |
| 1104 | for i in 0..parent.named_child_count() { |
| 1105 | if let Some(sib) = parent.named_child(i) { |
| 1106 | if sib.start_byte() == decl_start { |
| 1107 | decl_idx = Some(i); |
| 1108 | break; |
| 1109 | } |
| 1110 | } |
| 1111 | } |
| 1112 | if let Some(di) = decl_idx { |
| 1113 | for j in (0..di).rev() { |
| 1114 | let Some(sib) = parent.named_child(j) else { continue }; |
| 1115 | if !matches!(sib.kind(), "decorator" | "annotation" | "marker_annotation") { |
| 1116 | break; |
| 1117 | } |
| 1118 | self.consider_decorator(sib, decorated_row); |
| 1119 | } |
| 1120 | } |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 1125 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
no test coverage detected