Extract class methods
(
&self,
class_node: &Node,
source: &str,
file_path: &str,
entities: &mut Vec<Entity>,
)
| 775 | |
| 776 | /// Extract class methods |
| 777 | fn extract_class_members( |
| 778 | &self, |
| 779 | class_node: &Node, |
| 780 | source: &str, |
| 781 | file_path: &str, |
| 782 | entities: &mut Vec<Entity>, |
| 783 | ) { |
| 784 | let body = match class_node.child_by_field_name("body") { |
| 785 | Some(b) => b, |
| 786 | None => return, |
| 787 | }; |
| 788 | |
| 789 | for i in 0..body.child_count() { |
| 790 | if let Some(member) = body.child(i) { |
| 791 | if member.kind() == "method_definition" { |
| 792 | if let Some(entity) = self.extract_method(&member, source, file_path) { |
| 793 | entities.push(entity); |
| 794 | } |
| 795 | } |
| 796 | } |
| 797 | } |
| 798 | } |
| 799 | |
| 800 | /// Extract a method from a class |
| 801 | fn extract_method(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
no test coverage detected