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

Function property_bodies

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

1732/// `value` — an expression body's `=> …` or an `= initializer`. Attributes
1733/// are not walked.
1734fn property_bodies(node: Node) -> Vec<Node> {
1735 let mut bodies = Vec::new();
1736 if let Some(accessors) = node.child_by_field_name("accessors") {
1737 for i in 0..accessors.named_child_count() {
1738 let Some(accessor) = accessors.named_child(i) else { continue };
1739 if accessor.kind() != "accessor_declaration" {
1740 continue;
1741 }
1742 if let Some(body) = accessor.child_by_field_name("body") {
1743 bodies.push(body);
1744 }
1745 }
1746 }
1747 if let Some(value) = node.child_by_field_name("value") {
1748 bodies.push(value);
1749 }
1750 bodies
1751}
1752
1753fn last_named_child(node: Node) -> Option<Node> {
1754 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