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

Function named_child_after

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

The named child right after the first `token` child of `node`, if any.

(node: Node<'t>, token: &str)

Source from the content-addressed store, hash-verified

158
159/// The named child right after the first `token` child of `node`, if any.
160fn named_child_after<'t>(node: Node<'t>, token: &str) -> Option<Node<'t>> {
161 let mut seen = false;
162 for c in node.children(&mut node.walk()) {
163 if !c.is_named() {
164 if c.kind() == token {
165 seen = true;
166 }
167 continue;
168 }
169 if seen {
170 return Some(c);
171 }
172 }
173 None
174}
175
176/// The code a class, object or enum header holds, in source order (TS
177/// `kotlinClassHeaderCode`): each constructor parameter's default value

Callers 1

class_header_codeFunction · 0.85

Calls 2

childrenMethod · 0.80
walkMethod · 0.45

Tested by

no test coverage detected