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

Method visit

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

Source from the content-addressed store, hash-verified

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 }

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