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

Method extract_static_member_ref

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

Source from the content-addressed store, hash-verified

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

Callers 1

visit_bodyMethod · 0.45

Calls 10

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
walkMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected