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:555–595  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

553 }
554
555 fn visit_for_calls_and_structure(&mut self, node: Node<'t>) {
556 stack_guard!();
557 let kind = node.kind();
558 self.maybe_capture_fn_refs(node);
559
560 if kind == "call" {
561 self.extract_call(node);
562 } else if let Some(bare) = self.bare_call_name(node) {
563 // extractBareCall: statement-level identifiers in BLOCK_PARENTS
564 // bodies (`do…end` = body_statement; brace blocks are block_body —
565 // NOT in the set, so `5.times { beep }` emits nothing for beep).
566 let name = bare.to_string();
567 let from = self.top_row();
568 self.push_ref_at(from, &name, edge_kind_index("calls").unwrap(), node);
569 }
570
571 // (No INSTANTIATION_KINDS for ruby — `.new` is handled in extract_call;
572 // extractStaticMemberRef is gated off; no type annotations.)
573
574 // Nested NAMED defs become their own function nodes; classes extract.
575 // A `module` inside a body mints NOTHING (the visitNode hook does not
576 // run here) — its children just recurse. Same for singleton_method
577 // (functionTypes-only check): unmatched, recursed.
578 if kind == "method" {
579 let name = self.extract_name(node);
580 if name != "<anonymous>" {
581 self.extract_function(node);
582 return;
583 }
584 }
585 if kind == "class" {
586 self.extract_class(node);
587 return;
588 }
589
590 for i in 0..node.named_child_count() {
591 if let Some(c) = node.named_child(i) {
592 self.visit_for_calls_and_structure(c);
593 }
594 }
595 }
596
597 /// rubyExtractor.extractBareCall (languages/ruby.ts:77-105).
598 fn bare_call_name(&self, node: Node) -> Option<&'t str> {

Callers 1

visit_function_bodyMethod · 0.45

Calls 10

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

Tested by

no test coverage detected