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

Function property_bodies

codegraph-kernel/src/csharp.rs:1697–1713  ·  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

1695/// `value` — an expression body's `=> …` or an `= initializer`. Attributes
1696/// are not walked.
1697fn 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
1715fn last_named_child(node: Node) -> Option<Node> {
1716 node.named_child(node.named_child_count().checked_sub(1)?)

Callers 1

visit_nodeMethod · 0.85

Calls 2

pushMethod · 0.80
walkMethod · 0.45

Tested by

no test coverage detected