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

Source from the content-addressed store, hash-verified

722 }
723
724 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
725 let kind = node.kind();
726 self.maybe_capture_fn_refs(node);
727
728 if kind == "call_expression" {
729 self.extract_call(node);
730 }
731 // (INSTANTIATION_KINDS has no swift types; extractBareCall absent.)
732
733 self.extract_static_member_ref(node);
734
735 if kind == "function_declaration" {
736 let name = self.extract_name(node);
737 if name != "<anonymous>" {
738 self.extract_function(node);
739 return;
740 }
741 }
742 if kind == "class_declaration" {
743 let mut classified = "class";
744 for i in 0..node.child_count() {
745 if let Some(c) = node.child(i) {
746 if c.kind() == "struct" {
747 classified = "struct";
748 break;
749 }
750 if c.kind() == "enum" {
751 classified = "enum";
752 break;
753 }
754 }
755 }
756 match classified {
757 "struct" => self.extract_struct(node),
758 "enum" => self.extract_enum(node),
759 _ => self.extract_class(node),
760 }
761 return;
762 }
763 if kind == "protocol_declaration" {
764 self.extract_interface(node);
765 return;
766 }
767
768 for i in 0..node.named_child_count() {
769 if let Some(c) = node.named_child(i) {
770 self.visit_for_calls_and_structure(c);
771 }
772 }
773 }
774
775 // --- extractors -----------------------------------------------------------------
776

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