Accessors written on their OWN line parse as SIBLINGS of the property, not as children of it (same-line ones nest — see property_initializers). Walking back over any accessors between us and the declaration finds the property an accessor belongs to; None when this accessor stands alone.
(node: Node<'t>)
| 144 | /// back over any accessors between us and the declaration finds the property an |
| 145 | /// accessor belongs to; None when this accessor stands alone. |
| 146 | fn accessor_owner<'t>(node: Node<'t>) -> Option<Node<'t>> { |
| 147 | let mut p = node.prev_named_sibling(); |
| 148 | while let Some(n) = p { |
| 149 | if matches!(n.kind(), "getter" | "setter") { |
| 150 | p = n.prev_named_sibling(); |
| 151 | continue; |
| 152 | } |
| 153 | return if n.kind() == "property_declaration" { Some(n) } else { None }; |
| 154 | } |
| 155 | None |
| 156 | } |
| 157 | |
| 158 | /// The sibling accessors that follow a property declaration, in source order. |
| 159 | fn following_accessors<'t>(node: Node<'t>) -> Vec<Node<'t>> { |