(&mut self, node: Node<'t>)
| 534 | // --- the main walk (visitNode, tree-sitter.ts:936-1303) --------------- |
| 535 | |
| 536 | fn visit(&mut self, node: Node<'t>) { |
| 537 | stack_guard!(); |
| 538 | // The visitNode hook (scala.ts:131-198) runs FIRST. |
| 539 | if self.hook(node) { |
| 540 | self.scan_fn_ref_subtree(node, 0); |
| 541 | return; |
| 542 | } |
| 543 | |
| 544 | // maybeCaptureFnRefs (:990). |
| 545 | self.maybe_capture_fn_refs(node); |
| 546 | |
| 547 | let kind = node.kind(); |
| 548 | match kind { |
| 549 | // methodTypes (functionTypes is EMPTY — :994 never fires). |
| 550 | "function_definition" | "function_declaration" => { |
| 551 | self.extract_method_or_function(node); |
| 552 | return; // skipChildren |
| 553 | } |
| 554 | "class_definition" => { |
| 555 | self.extract_class(node, "class"); |
| 556 | return; |
| 557 | } |
| 558 | "object_definition" => { |
| 559 | self.extract_class(node, "module"); |
| 560 | return; |
| 561 | } |
| 562 | "trait_definition" => { |
| 563 | self.extract_class(node, "trait"); |
| 564 | return; |
| 565 | } |
| 566 | "enum_definition" => { |
| 567 | self.extract_enum(node); |
| 568 | return; |
| 569 | } |
| 570 | "type_definition" => { |
| 571 | let skip = self.extract_type_alias(node); |
| 572 | if skip { |
| 573 | return; |
| 574 | } |
| 575 | // plain path → false → children re-visited (nothing matches). |
| 576 | } |
| 577 | "import_declaration" => { |
| 578 | self.extract_import(node); |
| 579 | return; // skipChildren |
| 580 | } |
| 581 | "call_expression" => { |
| 582 | self.extract_call(node); |
| 583 | // no skipChildren — chains/args re-visited |
| 584 | } |
| 585 | "instance_expression" => { |
| 586 | // INSTANTIATION_KINDS (:1255). findAnonymousClassBody looks |
| 587 | // for class_body/declaration_list — scala's template_body is |
| 588 | // neither → extractAnonymousClass never runs → children |
| 589 | // recursed: anon-body defs LEAK to the enclosing scope. |
| 590 | self.extract_instantiation(node); |
| 591 | } |
| 592 | _ => {} |
| 593 | } |
no test coverage detected