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

Method visit

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

Source from the content-addressed store, hash-verified

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

Callers 4

extractFunction · 0.45
hookMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45

Calls 12

walkMethod · 0.80
hookMethod · 0.45
scan_fn_ref_subtreeMethod · 0.45
maybe_capture_fn_refsMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45
extract_importMethod · 0.45
extract_callMethod · 0.45
extract_instantiationMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected