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:800–850  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

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

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