findDescendant (lua.ts:9-17) — breadth-first over namedChildren.
(&self, node: Node<'t>, kind: &str)
| 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> { |