Extract class methods
(
&self,
class_node: &Node,
source: &str,
file_path: &str,
entities: &mut Vec<Entity>,
)
| 792 | |
| 793 | /// Extract class methods |
| 794 | fn extract_class_members( |
| 795 | &self, |
| 796 | class_node: &Node, |
| 797 | source: &str, |
| 798 | file_path: &str, |
| 799 | entities: &mut Vec<Entity>, |
| 800 | ) { |
| 801 | let body = match class_node.child_by_field_name("body") { |
| 802 | Some(b) => b, |
| 803 | None => return, |
| 804 | }; |
| 805 | |
| 806 | for i in 0..body.child_count() { |
| 807 | if let Some(member) = body.child(i) { |
| 808 | if member.kind() == "method_definition" { |
| 809 | if let Some(entity) = self.extract_method(&member, source, file_path) { |
| 810 | entities.push(entity); |
| 811 | } |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | /// Extract a method from a class |
| 818 | fn extract_method(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
no test coverage detected