(mut node: Node<'_>, source: &str)
| 248 | } |
| 249 | |
| 250 | fn module_scope(mut node: Node<'_>, source: &str) -> Vec<String> { |
| 251 | let mut parts = Vec::new(); |
| 252 | while let Some(parent) = node.parent() { |
| 253 | if matches!( |
| 254 | parent.kind(), |
| 255 | "mod_item" | "namespace_definition" | "internal_module" |
| 256 | ) { |
| 257 | if let Some(name) = parent.child_by_field_name("name") { |
| 258 | parts.push(text(name, source).into()); |
| 259 | } |
| 260 | } |
| 261 | node = parent; |
| 262 | } |
| 263 | parts.reverse(); |
| 264 | parts |
| 265 | } |
| 266 | |
| 267 | fn span(node: Node<'_>, path: &str) -> SourceSpan { |
| 268 | SourceSpan { |