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

Method visit_for_calls_and_structure

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

Source from the content-addressed store, hash-verified

580 }
581
582 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
583 stack_guard!();
584 let kind = node.kind();
585 self.maybe_capture_fn_refs(node);
586
587 if kind == "call" {
588 self.extract_call(node);
589 } else if let Some(bare) = self.bare_call_name(node) {
590 // extractBareCall: statement-level identifiers in BLOCK_PARENTS
591 // bodies (`do…end` = body_statement; brace blocks are block_body —
592 // NOT in the set, so `5.times { beep }` emits nothing for beep).
593 let name = bare.to_string();
594 let from = self.top_row();
595 self.push_ref_at(from, &name, edge_kind_index("calls").unwrap(), node);
596 }
597
598 // (No INSTANTIATION_KINDS for ruby — `.new` is handled in extract_call;
599 // extractStaticMemberRef is gated off; no type annotations.)
600
601 // Nested NAMED defs become their own function nodes; classes extract.
602 // A `module` inside a body mints NOTHING (the visitNode hook does not
603 // run here) — its children just recurse. Same for singleton_method
604 // (functionTypes-only check): unmatched, recursed.
605 if kind == "method" {
606 let name = self.extract_name(node);
607 if name != "<anonymous>" {
608 self.extract_function(node);
609 return;
610 }
611 }
612 if kind == "class" {
613 self.extract_class(node);
614 return;
615 }
616
617 for c in node.named_children(&mut node.walk()) {
618 self.visit_for_calls_and_structure(c);
619 }
620 }
621
622 /// rubyExtractor.extractBareCall (languages/ruby.ts:77-105).
623 fn bare_call_name(&self, node: Node) -> Option<&'t str> {

Callers 1

visit_function_bodyMethod · 0.45

Calls 11

edge_kind_indexFunction · 0.85
unwrapMethod · 0.60
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
bare_call_nameMethod · 0.45
top_rowMethod · 0.45
push_ref_atMethod · 0.45
extract_nameMethod · 0.45
extract_functionMethod · 0.45
extract_classMethod · 0.45
walkMethod · 0.45

Tested by

no test coverage detected