Build a class signature string.
(&self, node: &Node, source: &str)
| 328 | |
| 329 | /// Build a class signature string. |
| 330 | fn build_class_signature(&self, node: &Node, source: &str) -> Option<String> { |
| 331 | let name_node = node.child_by_field_name("name")?; |
| 332 | let name = self.node_text(&name_node, source); |
| 333 | |
| 334 | // Check for base classes in superclasses/argument_list |
| 335 | let bases = node |
| 336 | .child_by_field_name("superclasses") |
| 337 | .map(|n| self.node_text(&n, source)); |
| 338 | |
| 339 | match bases { |
| 340 | Some(b) if !b.is_empty() && b != "()" => Some(format!("class {}{}", name, b)), |
| 341 | _ => Some(format!("class {}", name)), |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | /// Get the text content of a node. |
| 346 | fn node_text(&self, node: &Node, source: &str) -> String { |
no test coverage detected