(&mut self, node: Node<'t>)
| 691 | } |
| 692 | |
| 693 | fn extract_class(&mut self, node: Node<'t>) { |
| 694 | stack_guard!(); |
| 695 | let name = self.extract_name(node); |
| 696 | let extra = Extra { |
| 697 | docstring: preceding_docstring(node, self.src), |
| 698 | signature: None, |
| 699 | visibility: Some(self.visibility_of(node)), |
| 700 | ..Extra::default() |
| 701 | }; |
| 702 | let Some(row) = self.create_node("class", &name, node, extra) else { return }; |
| 703 | |
| 704 | // extractInheritance: the `superclass` clause — ONE extends ref, FULL |
| 705 | // text (scope_resolution / even `Struct.new(:a)` expressions verbatim), |
| 706 | // positioned at the type child. |
| 707 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 708 | for child in node.named_children(&mut node.walk()) { |
| 709 | if child.kind() == "superclass" { |
| 710 | if let Some(target) = child.named_child(0) { |
| 711 | let tname = self.text(target).to_string(); |
| 712 | self.push_ref_at(row, &tname, extends_kind, target); |
| 713 | } |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | self.stack.push(Scope { row, kind: "class", name }); |
| 718 | // Bodiless `class X; end` has no body field → the class node itself |
| 719 | // is walked (name/superclass children revisit harmlessly). |
| 720 | let body = node.child_by_field_name("body").unwrap_or(node); |
| 721 | for c in body.named_children(&mut body.walk()) { |
| 722 | self.visit_node(c); |
| 723 | } |
| 724 | self.stack.pop(); |
| 725 | } |
| 726 | |
| 727 | /// extractVariable — the python/ruby assignment branch (2709-2727): |
| 728 | /// identifier or constant LHS mints a `variable` node (no isConst hook — |
no test coverage detected