MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / property_bodies

Function property_bodies

codegraph-kernel/src/csharp.rs:1706–1723  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1704/// `value` — an expression body's `=> …` or an `= initializer`. Attributes
1705/// are not walked.
1706fn property_bodies(node: Node) -> Vec<Node> {
1707 let mut bodies = Vec::new();
1708 if let Some(accessors) = node.child_by_field_name("accessors") {
1709 for i in 0..accessors.named_child_count() {
1710 let Some(accessor) = accessors.named_child(i) else { continue };
1711 if accessor.kind() != "accessor_declaration" {
1712 continue;
1713 }
1714 if let Some(body) = accessor.child_by_field_name("body") {
1715 bodies.push(body);
1716 }
1717 }
1718 }
1719 if let Some(value) = node.child_by_field_name("value") {
1720 bodies.push(value);
1721 }
1722 bodies
1723}
1724
1725fn last_named_child(node: Node) -> Option<Node> {
1726 node.named_child(node.named_child_count().checked_sub(1)?)

Callers 1

visit_nodeMethod · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected