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

Method find_descendant

codegraph-kernel/src/lua.rs:280–296  ·  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

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