The Kotlin visitNode hook: `Some` when it consumed the node, holding the initializers it walked as such (`walkInitializer`), which the caller's fn-ref scan of the node skips.
(&mut self, node: Node<'t>)
| 759 | /// initializers it walked as such (`walkInitializer`), which the caller's |
| 760 | /// fn-ref scan of the node skips. |
| 761 | fn try_visit_hook(&mut self, node: Node<'t>) -> Option<Vec<usize>> { |
| 762 | // An own-line accessor already walked by its owning property below. The |
| 763 | // ownership test re-derives the property's kind rather than remembering |
| 764 | // it: a destructured or local declaration mints no node, so its |
| 765 | // accessors were NOT consumed and must keep falling through. |
| 766 | if matches!(node.kind(), "getter" | "setter") { |
| 767 | return accessor_owner(node) |
| 768 | .and_then(|owner| self.property_kind(owner)) |
| 769 | .map(|_| Vec::new()); |
| 770 | } |
| 771 | if node.kind() != "property_declaration" { |
| 772 | return None; |
| 773 | } |
| 774 | let var_decl = (0..node.named_child_count()) |
| 775 | .filter_map(|i| node.named_child(i)) |
| 776 | .find(|c| c.kind() == "variable_declaration"); |
| 777 | let name_node = var_decl.and_then(|vd| { |
| 778 | (0..vd.named_child_count()) |
| 779 | .filter_map(|i| vd.named_child(i)) |
| 780 | .find(|c| c.kind() == "simple_identifier") |
| 781 | }); |
| 782 | // Destructuring (`val (a, b) = makePair()`): NEITHER arm mints a symbol |
| 783 | // for the destructured names — declining just routes the node to |
| 784 | // extractField/extractVariable, which both find nothing for kotlin and |
| 785 | // end in the same fn-ref scan. But the RHS is CODE, and it was vanishing |
| 786 | // whole. Consume the node here and walk it at the ENCLOSING scope (no |
| 787 | // symbol of its own to attribute to). |
| 788 | let Some(name_node) = name_node else { |
| 789 | for init in property_initializers(node) { |
| 790 | self.visit_function_body(init); |
| 791 | } |
| 792 | return Some(Vec::new()); |
| 793 | }; |
| 794 | let name = self.text(name_node).to_string(); |
| 795 | if name.is_empty() { |
| 796 | return None; |
| 797 | } |
| 798 | let Some(kind) = self.property_kind(node) else { |
| 799 | // A local — no node is minted, but the initializer is still code. |
| 800 | // Walk it at the ENCLOSING scope: an `init { }` block's |
| 801 | // `val q = load()` is the CLASS calling load, and it used to |
| 802 | // disappear entirely (only the block's bare statements survived). |
| 803 | for init in property_initializers(node) { |
| 804 | self.visit_function_body(init); |
| 805 | } |
| 806 | return Some(Vec::new()); |
| 807 | }; |
| 808 | // The `type`-field signature read is dead (zero fields) → signature |
| 809 | // undefined; NO docstring/isStatic — the modifiers merge in |
| 810 | // create_node still decorates expect/actual properties. Visibility IS |
| 811 | // read: a `private val` is file-local to the resolver (#1731). |
| 812 | let extra = Extra { visibility: Some(self.visibility_of(node)), ..Extra::default() }; |
| 813 | let row = self.create_node(kind, &name, node, extra); |
| 814 | // Walk the initializer ATTRIBUTED to the declared symbol (#693, the Go |
| 815 | // fix, ported): without this the subtree is only fn-ref-scanned, so a |
| 816 | // lambda / SAM / object initializer (`val cb = Runnable { target() }` — |
| 817 | // the idiomatic Android callback field) contributed NO call edge at all. |
| 818 | // The property also OWNS any accessor written on its own line, which the |
no test coverage detected