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

Method extract_member_read

codegraph-kernel/src/dart.rs:1822–1857  ·  view source on GitHub ↗

dartMemberRead (dart.ts) — `x.area` / `x?.area` not followed by a call's argument part, receiver a plain name: a `references` ref `x.area` on `area`, which the resolver links to a getter only (#2338).

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1820 /// argument part, receiver a plain name: a `references` ref `x.area` on
1821 /// `area`, which the resolver links to a getter only (#2338).
1822 fn extract_member_read(&mut self, node: Node<'t>) {
1823 if node.kind() != "selector" {
1824 return;
1825 }
1826 let mut cursor = node.walk();
1827 let accessor = node.named_children(&mut cursor).find(|c| {
1828 matches!(c.kind(), "unconditional_assignable_selector" | "conditional_assignable_selector")
1829 });
1830 let member = accessor.and_then(|a| {
1831 let mut ac = a.walk();
1832 let found = a.named_children(&mut ac).find(|c| c.kind() == "identifier");
1833 found
1834 });
1835 let Some(member) = member else { return };
1836 let Some(receiver) = prev_named(node) else { return };
1837 if receiver.kind() != "identifier" {
1838 return;
1839 }
1840 let next = next_named(node);
1841 if let Some(next) = next {
1842 if next.kind() == "selector" {
1843 let mut nc = next.walk();
1844 if next.named_children(&mut nc).any(|c| c.kind() == "argument_part") {
1845 return;
1846 }
1847 }
1848 }
1849 // The callee of a generic call the grammar read as comparisons
1850 // (`ref.read<Repo>(p)`) is called; a prefixed type argument names a type.
1851 if self.in_misparsed_generic_call(receiver, next, node.parent()) {
1852 return;
1853 }
1854 let name = format!("{}.{}", self.text(receiver), self.text(member));
1855 let reader = self.top_row();
1856 self.push_ref_at(reader, &name, "references", member);
1857 }
1858
1859 // --- visitFunctionBody (:5129-5286) — dart rows -----------------------
1860

Callers 1

visit_bodyMethod · 0.80

Calls 6

prev_namedFunction · 0.85
next_namedFunction · 0.85
walkMethod · 0.80
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected