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

Method visit_node

codegraph-kernel/src/go.rs:415–453  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

413 // --- visitNode ------------------------------------------------------------
414
415 fn visit_node(&mut self, node: Node<'t>) {
416 stack_guard!();
417 let kind = node.kind();
418 let mut skip_children = false;
419
420 self.maybe_capture_fn_refs(node);
421
422 if kind == "function_declaration" {
423 self.extract_function(node);
424 skip_children = true;
425 } else if kind == "method_declaration" {
426 self.extract_method(node);
427 skip_children = true;
428 } else if kind == "type_spec" || kind == "type_alias" {
429 skip_children = self.extract_type_alias(node);
430 } else if matches!(kind, "var_declaration" | "short_var_declaration" | "const_declaration")
431 && !self.inside_class_like()
432 {
433 // The initializers extract_variable walked under their specs'
434 // symbols took their own candidates; the scan covers the rest.
435 let walked = self.extract_variable(node);
436 self.scan_fn_ref_subtree(node, 0, &walked);
437 skip_children = true;
438 } else if kind == "import_declaration" {
439 self.extract_import(node);
440 } else if kind == "call_expression" {
441 self.extract_call(node);
442 } else if kind == "composite_literal" {
443 self.extract_instantiation(node);
444 }
445
446 if !skip_children {
447 for i in 0..node.named_child_count() {
448 if let Some(c) = node.named_child(i) {
449 self.visit_node(c);
450 }
451 }
452 }
453 }
454
455 fn visit_function_body(&mut self, body: Node<'t>) {
456 stack_guard!();

Callers 2

extractFunction · 0.45
extract_type_aliasMethod · 0.45

Calls 10

maybe_capture_fn_refsMethod · 0.45
extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_type_aliasMethod · 0.45
inside_class_likeMethod · 0.45
extract_variableMethod · 0.45
scan_fn_ref_subtreeMethod · 0.45
extract_importMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45

Tested by

no test coverage detected