propertyBodies (tree-sitter.ts) — the parts of a property that run code: each accessor's `body` (a block or `=> expr`), then the property's `value` — an expression body's `=> …` or an `= initializer`. Attributes are not walked.
(node: Node)
| 1695 | /// `value` — an expression body's `=> …` or an `= initializer`. Attributes |
| 1696 | /// are not walked. |
| 1697 | fn property_bodies(node: Node) -> Vec<Node> { |
| 1698 | let mut bodies = Vec::new(); |
| 1699 | if let Some(accessors) = node.child_by_field_name("accessors") { |
| 1700 | for accessor in accessors.named_children(&mut accessors.walk()) { |
| 1701 | if accessor.kind() != "accessor_declaration" { |
| 1702 | continue; |
| 1703 | } |
| 1704 | if let Some(body) = accessor.child_by_field_name("body") { |
| 1705 | bodies.push(body); |
| 1706 | } |
| 1707 | } |
| 1708 | } |
| 1709 | if let Some(value) = node.child_by_field_name("value") { |
| 1710 | bodies.push(value); |
| 1711 | } |
| 1712 | bodies |
| 1713 | } |
| 1714 | |
| 1715 | fn last_named_child(node: Node) -> Option<Node> { |
| 1716 | node.named_child(node.named_child_count().checked_sub(1)?) |
no test coverage detected