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