Extract class methods
(
&self,
class_node: &Node,
source: &str,
file_path: &str,
entities: &mut Vec<Entity>,
)
| 820 | |
| 821 | /// Extract class methods |
| 822 | fn extract_class_members( |
| 823 | &self, |
| 824 | class_node: &Node, |
| 825 | source: &str, |
| 826 | file_path: &str, |
| 827 | entities: &mut Vec<Entity>, |
| 828 | ) { |
| 829 | let body = match class_node.child_by_field_name("body") { |
| 830 | Some(b) => b, |
| 831 | None => return, |
| 832 | }; |
| 833 | |
| 834 | for i in 0..body.child_count() { |
| 835 | if let Some(member) = body.child(i) { |
| 836 | if member.kind() == "method_definition" { |
| 837 | if let Some(entity) = self.extract_method(&member, source, file_path) { |
| 838 | entities.push(entity); |
| 839 | } |
| 840 | } |
| 841 | } |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | /// Extract a method from a class |
| 846 | fn extract_method(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> { |
no test coverage detected