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

Method extract_class_members

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

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

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