Build a class signature string.
(&self, node: &Node, source: &str)
| 427 | |
| 428 | /// Build a class signature string. |
| 429 | fn build_class_signature(&self, node: &Node, source: &str) -> Option<String> { |
| 430 | let name_node = node.child_by_field_name("name")?; |
| 431 | let name = self.node_text(&name_node, source); |
| 432 | |
| 433 | let vis = self.get_visibility(node, source); |
| 434 | let is_abstract = self.has_modifier(node, source, "abstract"); |
| 435 | let is_final = self.has_modifier(node, source, "final"); |
| 436 | |
| 437 | let mut parts = Vec::new(); |
| 438 | if !vis.is_empty() { |
| 439 | parts.push(vis.trim().to_string()); |
| 440 | } |
| 441 | if is_abstract { |
| 442 | parts.push("abstract".to_string()); |
| 443 | } |
| 444 | if is_final { |
| 445 | parts.push("final".to_string()); |
| 446 | } |
| 447 | parts.push("class".to_string()); |
| 448 | parts.push(name.clone()); |
| 449 | |
| 450 | // Check for type parameters |
| 451 | if let Some(type_params) = node.child_by_field_name("type_parameters") { |
| 452 | parts.push(self.node_text(&type_params, source)); |
| 453 | } |
| 454 | |
| 455 | // Check for superclass |
| 456 | if let Some(superclass) = node.child_by_field_name("superclass") { |
| 457 | parts.push(format!("extends {}", self.node_text(&superclass, source))); |
| 458 | } |
| 459 | |
| 460 | // Check for interfaces |
| 461 | if let Some(interfaces) = node.child_by_field_name("interfaces") { |
| 462 | parts.push(format!( |
| 463 | "implements {}", |
| 464 | self.node_text(&interfaces, source) |
| 465 | )); |
| 466 | } |
| 467 | |
| 468 | Some(parts.join(" ")) |
| 469 | } |
| 470 | |
| 471 | /// Build an interface signature string. |
| 472 | fn build_interface_signature(&self, node: &Node, source: &str) -> Option<String> { |
no test coverage detected