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

Source from the content-addressed store, hash-verified

785 }
786
787 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
788 stack_guard!();
789 let kind = node.kind();
790 self.maybe_capture_fn_refs(node);
791
792 if kind == "call_expression" {
793 self.extract_call(node);
794 }
795 // (INSTANTIATION_KINDS has no swift types; extractBareCall absent.)
796
797 self.extract_static_member_ref(node);
798
799 if kind == "function_declaration" {
800 let name = self.extract_name(node);
801 if name != "<anonymous>" {
802 self.extract_function(node);
803 return;
804 }
805 }
806 if kind == "class_declaration" {
807 let mut classified = "class";
808 for c in node.children(&mut node.walk()) {
809 if c.kind() == "struct" {
810 classified = "struct";
811 break;
812 }
813 if c.kind() == "enum" {
814 classified = "enum";
815 break;
816 }
817 }
818 match classified {
819 "struct" => self.extract_struct(node),
820 "enum" => self.extract_enum(node),
821 _ => self.extract_class(node),
822 }
823 return;
824 }
825 if kind == "protocol_declaration" {
826 self.extract_interface(node);
827 return;
828 }
829
830 for c in node.named_children(&mut node.walk()) {
831 self.visit_for_calls_and_structure(c);
832 }
833 }
834
835 // --- extractors -----------------------------------------------------------------
836

Callers 1

visit_function_bodyMethod · 0.45

Calls 11

childrenMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
walkMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_classMethod · 0.45
extract_interfaceMethod · 0.45

Tested by

no test coverage detected