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

Method visit

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

Source from the content-addressed store, hash-verified

596 // --- the main walk (visitNode, tree-sitter.ts:936-1303) ---------------
597
598 fn visit(&mut self, node: Node<'t>) {
599 stack_guard!();
600 // The visitNode hook (dart.ts:144-157) — the constants branch.
601 if node.kind() == "static_final_declaration" {
602 let mut cursor = node.walk();
603 let name_node = node.named_children(&mut cursor).find(|c| c.kind() == "identifier");
604 if let Some(name_node) = name_node {
605 // signature = first value sibling's text, sliced to 100
606 // UTF-16 units (a flattened chain captures just its head).
607 let signature = name_node.next_named_sibling().map(|v| {
608 let (sliced, _) = util::slice_utf16(self.text(v), 100);
609 if util::utf16_len(&sliced) >= 100 {
610 format!("= {sliced}...")
611 } else {
612 format!("= {sliced}")
613 }
614 });
615 let name = self.text(name_node).to_string();
616 self.create_node("constant", &name, node, Extra { signature, ..Default::default() });
617 }
618 self.scan_fn_ref_subtree(node, 0);
619 return;
620 }
621
622 // maybeCaptureFnRefs (:990) — the double-walk fn-ref twin source.
623 self.maybe_capture_fn_refs(node);
624
625 match node.kind() {
626 "function_signature" => {
627 // functionTypes row — method_signature does NOT include it →
628 // always extractFunction, even inside a class (abstract
629 // members become kind `function` contained by the class).
630 self.extract_function(node);
631 return;
632 }
633 "class_definition" | "mixin_declaration" | "extension_declaration" => {
634 self.extract_class(node);
635 return;
636 }
637 "method_signature" | "constructor_signature" => {
638 self.extract_method(node);
639 return;
640 }
641 "enum_declaration" => {
642 self.extract_enum(node);
643 return;
644 }
645 "type_alias" => {
646 let skip = self.extract_type_alias(node);
647 if skip {
648 return;
649 }
650 }
651 "import_or_export" => {
652 self.extract_import(node);
653 return;
654 }
655 "new_expression" => {

Callers 3

extractFunction · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45

Calls 14

slice_utf16Function · 0.85
utf16_lenFunction · 0.85
textMethod · 0.65
create_nodeMethod · 0.45
scan_fn_ref_subtreeMethod · 0.45
maybe_capture_fn_refsMethod · 0.45
extract_functionMethod · 0.45
extract_classMethod · 0.45
extract_methodMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45
extract_importMethod · 0.45

Tested by

no test coverage detected