MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / visit_for_calls_and_structure

Method visit_for_calls_and_structure

codegraph-kernel/src/swift.rs:801–851  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

799 }
800
801 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
802 stack_guard!();
803 let kind = node.kind();
804 self.maybe_capture_fn_refs(node);
805
806 if kind == "call_expression" {
807 self.extract_call(node);
808 }
809 // (INSTANTIATION_KINDS has no swift types; extractBareCall absent.)
810
811 self.extract_static_member_ref(node);
812
813 if kind == "function_declaration" {
814 let name = self.extract_name(node);
815 if name != "<anonymous>" {
816 self.extract_function(node);
817 return;
818 }
819 }
820 if kind == "class_declaration" {
821 let mut classified = "class";
822 for i in 0..node.child_count() {
823 if let Some(c) = node.child(i) {
824 if c.kind() == "struct" {
825 classified = "struct";
826 break;
827 }
828 if c.kind() == "enum" {
829 classified = "enum";
830 break;
831 }
832 }
833 }
834 match classified {
835 "struct" => self.extract_struct(node),
836 "enum" => self.extract_enum(node),
837 _ => self.extract_class(node),
838 }
839 return;
840 }
841 if kind == "protocol_declaration" {
842 self.extract_interface(node);
843 return;
844 }
845
846 for i in 0..node.named_child_count() {
847 if let Some(c) = node.named_child(i) {
848 self.visit_for_calls_and_structure(c);
849 }
850 }
851 }
852
853 // --- extractors -----------------------------------------------------------------
854

Callers 1

visit_function_bodyMethod · 0.45

Calls 9

maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_classMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected