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

Method find_descendant

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

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

Callers 1

require_moduleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected