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

Function accessor_owner

codegraph-kernel/src/kotlin.rs:147–157  ·  view source on GitHub ↗

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>)

Source from the content-addressed store, hash-verified

145/// back over any accessors between us and the declaration finds the property an
146/// accessor belongs to; None when this accessor stands alone.
147fn accessor_owner<'t>(node: Node<'t>) -> Option<Node<'t>> {
148 let mut p = node.prev_named_sibling();
149 while let Some(n) = p {
150 if matches!(n.kind(), "getter" | "setter") {
151 p = n.prev_named_sibling();
152 continue;
153 }
154 return if n.kind() == "property_declaration" { Some(n) } else { None };
155 }
156 None
157}
158
159/// The sibling accessors that follow a property declaration, in source order.
160fn following_accessors<'t>(node: Node<'t>) -> Vec<Node<'t>> {

Callers 1

try_visit_hookMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected