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

Method visit_node

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

Source from the content-addressed store, hash-verified

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

Callers 2

extractFunction · 0.45
extract_type_aliasMethod · 0.45

Calls 12

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
collectMethod · 0.45
extract_importMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
walkMethod · 0.45

Tested by

no test coverage detected