MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_class_members

Method extract_class_members

atomic-semantic/src/parser.rs:822–843  ·  view source on GitHub ↗

Extract class methods

(
        &self,
        class_node: &Node,
        source: &str,
        file_path: &str,
        entities: &mut Vec<Entity>,
    )

Source from the content-addressed store, hash-verified

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> {

Callers 1

walk_treeMethod · 0.80

Calls 4

child_countMethod · 0.80
kindMethod · 0.45
extract_methodMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected