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