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

Method extract_class_members

atomic-semantic/src/parser.rs:794–815  ·  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

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

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