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

Source from the content-addressed store, hash-verified

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

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