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

Method visit_node

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

Source from the content-addressed store, hash-verified

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