(&mut self, node: Node<'t>)
| 429 | } |
| 430 | |
| 431 | fn extract_class(&mut self, node: Node<'t>) { |
| 432 | let name = self.extract_name(node); |
| 433 | let extra = Extra { |
| 434 | docstring: preceding_docstring(node, self.src), |
| 435 | ..Extra::default() |
| 436 | }; |
| 437 | let Some(row) = self.create_node("class", &name, node, extra) else { return }; |
| 438 | |
| 439 | // Inheritance: `class Flask(Scaffold, Mixin):` — argument_list children. |
| 440 | let extends_kind = edge_kind_index("extends").unwrap(); |
| 441 | for i in 0..node.named_child_count() { |
| 442 | let Some(child) = node.named_child(i) else { continue }; |
| 443 | if child.kind() == "argument_list" { |
| 444 | for j in 0..child.named_child_count() { |
| 445 | let Some(arg) = child.named_child(j) else { continue }; |
| 446 | if matches!(arg.kind(), "identifier" | "attribute") { |
| 447 | let name = self.text(arg).to_string(); |
| 448 | self.push_ref_at(row, &name, extends_kind, arg); |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | self.extract_decorators_for(node, row); |
| 454 | |
| 455 | self.stack.push(Scope { row, kind: "class", name }); |
| 456 | let body = node.child_by_field_name("body").unwrap_or(node); |
| 457 | for i in 0..body.named_child_count() { |
| 458 | if let Some(c) = body.named_child(i) { |
| 459 | self.visit_node(c); |
| 460 | } |
| 461 | } |
| 462 | self.stack.pop(); |
| 463 | } |
| 464 | |
| 465 | /// extractVariable's python branch: `left = right` at module scope. |
| 466 | fn extract_variable(&mut self, node: Node<'t>) { |
no test coverage detected