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