(&mut self, node: Node<'t>)
| 634 | } |
| 635 | |
| 636 | fn extract_class(&mut self, node: Node<'t>) { |
| 637 | let name = self.extract_name(node); |
| 638 | let extra = Extra { |
| 639 | docstring: preceding_docstring(node, self.src), |
| 640 | signature: None, |
| 641 | visibility: Some(self.visibility_of(node)), |
| 642 | }; |
| 643 | let Some(row) = self.create_node("class", &name, node, extra) else { return }; |
| 644 | |
| 645 | // extractInheritance: the `superclass` clause — ONE extends ref, FULL |
| 646 | // text (scope_resolution / even `Struct.new(:a)` expressions verbatim), |
| 647 | // positioned at the type child. |
| 648 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 649 | for i in 0..node.named_child_count() { |
| 650 | let Some(child) = node.named_child(i) else { continue }; |
| 651 | if child.kind() == "superclass" { |
| 652 | if let Some(target) = child.named_child(0) { |
| 653 | let tname = self.text(target).to_string(); |
| 654 | self.push_ref_at(row, &tname, extends_kind, target); |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | self.stack.push(Scope { row, kind: "class", name }); |
| 660 | // Bodiless `class X; end` has no body field → the class node itself |
| 661 | // is walked (name/superclass children revisit harmlessly). |
| 662 | let body = node.child_by_field_name("body").unwrap_or(node); |
| 663 | for i in 0..body.named_child_count() { |
| 664 | if let Some(c) = body.named_child(i) { |
| 665 | self.visit_node(c); |
| 666 | } |
| 667 | } |
| 668 | self.stack.pop(); |
| 669 | } |
| 670 | |
| 671 | /// extractVariable — the python/ruby assignment branch (2709-2727): |
| 672 | /// identifier or constant LHS mints a `variable` node (no isConst hook — |
no test coverage detected