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

Function accessor_owner

codegraph-kernel/src/kotlin.rs:146–156  ·  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

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