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