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

Method extract_static_member_ref

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

Source from the content-addressed store, hash-verified

1898 // --- extractStaticMemberRef — the dart branch (:4759-4767) ------------
1899
1900 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1901 if self.stack.is_empty() {
1902 return;
1903 }
1904 let owner_row = self.top_row();
1905 if node.kind() != "selector" {
1906 return;
1907 }
1908 let mut cursor = node.walk();
1909 if node.named_children(&mut cursor).any(|c| c.kind() == "argument_part") {
1910 return;
1911 }
1912 // So is `Map` in `List<Map<K, V>>.from(m)` when the grammar split the
1913 // call into comparisons: the body walker references the call's types.
1914 if let Some(parent) = node.parent().filter(|p| p.kind() == "relational_expression") {
1915 if self.misparsed_ctor_in(parent, node) {
1916 return;
1917 }
1918 }
1919 let prev = self.receiver_of(node);
1920 if let Some(prev) = prev.filter(|p| p.kind() == "identifier" && cap_ident_re().is_match(self.text(*p))) {
1921 // `Map` in `x.read<Map<K, V>>(y)` parsed as comparisons is a type
1922 // argument, which the body walker references as a type.
1923 if let Some(before) = prev.prev_named_sibling() {
1924 if before.kind() == "relational_operator" && self.misparsed_generic_call(before).is_some() {
1925 return;
1926 }
1927 }
1928 let name = self.text(prev).to_string();
1929 // NO callee-of-call skip — `ConfigT.load()` double-emits
1930 // (references + calls). Position = the IDENTIFIER (receiver).
1931 self.push_ref_at(owner_row, &name, "references", prev);
1932 return;
1933 }
1934 // The type a `<…>` follows is referenced as a type, `_Box` and `$Box`
1935 // in `_Box<T>.named(…)` too, and `Box` after an import prefix in
1936 // `p.Box<T>.named(…)`.
1937 if let Some(type_node) = self.type_arguments_type(node).filter(|t| self.is_type_name_dart(*t)) {
1938 let name = self.text(type_node).to_string();
1939 self.push_ref_at(owner_row, &name, "references", type_node);
1940 }
1941 }
1942
1943 // --- extractDecoratorsFor (:4897-5024) — the sibling scan -------------
1944

Callers 1

visit_bodyMethod · 0.45

Calls 10

walkMethod · 0.80
misparsed_ctor_inMethod · 0.80
receiver_ofMethod · 0.80
type_arguments_typeMethod · 0.80
is_type_name_dartMethod · 0.80
cap_ident_reFunction · 0.70
textMethod · 0.65
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected