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

Method find_descendant

codegraph-kernel/src/lua.rs:282–298  ·  view source on GitHub ↗

findDescendant (lua.ts:9-17) — breadth-first over namedChildren.

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

Source from the content-addressed store, hash-verified

280
281 /// findDescendant (lua.ts:9-17) — breadth-first over namedChildren.
282 fn find_descendant(&self, node: Node<'t>, kind: &str) -> Option<Node<'t>> {
283 let mut queue: VecDeque<Node<'t>> = VecDeque::new();
284 let mut cursor = node.walk();
285 for c in node.named_children(&mut cursor) {
286 queue.push_back(c);
287 }
288 while let Some(n) = queue.pop_front() {
289 if n.kind() == kind {
290 return Some(n);
291 }
292 let mut cur = n.walk();
293 for c in n.named_children(&mut cur) {
294 queue.push_back(c);
295 }
296 }
297 None
298 }
299
300 /// requireModule (lua.ts:28-60).
301 fn require_module(&self, call: Node<'t>) -> Option<String> {

Callers 1

require_moduleMethod · 0.80

Calls 1

walkMethod · 0.80

Tested by

no test coverage detected