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

Method visit_for_calls_and_structure

codegraph-kernel/src/tsjs/mod.rs:690–734  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

688 }
689
690 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
691 stack_guard!();
692 let kind = node.kind();
693 self.maybe_capture_fn_refs(node);
694
695 if kind == "call_expression" {
696 self.extract_call(node);
697 } else if kind == "new_expression" {
698 self.extract_instantiation(node);
699 }
700
701 // Local variable type annotations (TS family only).
702 if self.variant.is_ts() && kind == "variable_declarator" {
703 let owner = self.top_row();
704 self.extract_variable_type_annotation(node, owner);
705 }
706
707 // Nested NAMED functions become their own nodes.
708 if is_function_type(kind) {
709 let name = self.extract_name(node);
710 if name != "<anonymous>" {
711 self.extract_function(node, None);
712 return;
713 }
714 }
715
716 if is_class_type(self.variant, kind) {
717 self.extract_class(node);
718 return;
719 }
720 if self.variant.is_ts() && kind == "enum_declaration" {
721 self.extract_enum(node);
722 return;
723 }
724 if self.variant.is_ts() && kind == "interface_declaration" {
725 self.extract_interface(node);
726 return;
727 }
728
729 for i in 0..node.named_child_count() {
730 if let Some(c) = node.named_child(i) {
731 self.visit_for_calls_and_structure(c);
732 }
733 }
734 }
735
736 // --- name / signature / modifier helpers ------------------------------------
737

Callers 1

visit_function_bodyMethod · 0.45

Calls 13

is_function_typeFunction · 0.85
is_class_typeFunction · 0.85
is_tsMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
top_rowMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45

Tested by

no test coverage detected