extractName (tree-sitter.ts:98-192) — scala-reachable branches: the `name` field's raw text (operator glyphs and backticks kept), else the first identifier-ish child, else ` `.
(&self, node: Node<'t>)
| 514 | /// `name` field's raw text (operator glyphs and backticks kept), else the |
| 515 | /// first identifier-ish child, else `<anonymous>`. |
| 516 | fn extract_name(&self, node: Node<'t>) -> String { |
| 517 | if let Some(name_node) = node.child_by_field_name("name") { |
| 518 | return self.text(name_node).to_string(); |
| 519 | } |
| 520 | let mut cursor = node.walk(); |
| 521 | for c in node.named_children(&mut cursor) { |
| 522 | if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") { |
| 523 | return self.text(c).to_string(); |
| 524 | } |
| 525 | } |
| 526 | "<anonymous>".to_string() |
| 527 | } |
| 528 | |
| 529 | // --- the main walk (visitNode, tree-sitter.ts:936-1303) --------------- |
| 530 |
no test coverage detected