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

Method visit_body

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

Source from the content-addressed store, hash-verified

1859 // --- visitFunctionBody (:5129-5286) — dart rows -----------------------
1860
1861 fn visit_body(&mut self, node: Node<'t>) {
1862 stack_guard!();
1863 self.maybe_capture_fn_refs(node);
1864
1865 let kind = node.kind();
1866 if kind == "new_expression" {
1867 // INSTANTIATION branch fires first — extractBareCall's
1868 // new_expression arm is dead. Children still recursed.
1869 self.extract_instantiation(node);
1870 } else if let Some(callee) = self.bare_call_name(node) {
1871 // extractBareCall (:5159-5173) — ref at the MATCHED node.
1872 if !self.stack.is_empty() {
1873 let caller_row = self.top_row();
1874 self.push_ref_at(caller_row, &callee, "calls", node);
1875 }
1876 }
1877
1878 self.extract_static_member_ref(node);
1879
1880 // A getter read `x.area` (#2338); a type the body names (#2327) — the
1881 // type argument of a generic call parsed as comparisons included.
1882 self.extract_member_read(node);
1883 let type_node = match kind {
1884 "type_identifier" => Some(node),
1885 "relational_operator" => self.misparsed_generic_call(node).map(|(_, type_name)| type_name),
1886 _ => None,
1887 };
1888 if let Some(type_node) = type_node.filter(|t| self.is_type_name_dart(*t)) {
1889 let name = self.text(type_node).to_string();
1890 let owner = self.top_row();
1891 self.push_ref_at(owner, &name, "references", type_node);
1892 }
1893
1894 if kind == "function_signature" {
1895 // Nested named functions (:5245) — extractFunction walks the
1896 // nested body itself; the enclosing walker ALSO revisits the
1897 // sibling function_body (double-walk pass 2b) via recursion.
1898 self.extract_function(node);
1899 return;
1900 }
1901
1902 let mut cursor = node.walk();
1903 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
1904 for child in children {
1905 self.visit_body(child);
1906 }
1907 }
1908
1909 // --- function-as-value capture (#756) — DART_SPEC ---------------------
1910

Callers 3

visitMethod · 0.45
extract_functionMethod · 0.45
extract_methodMethod · 0.45

Calls 14

extract_member_readMethod · 0.80
mapMethod · 0.80
is_type_name_dartMethod · 0.80
walkMethod · 0.80
textMethod · 0.65
maybe_capture_fn_refsMethod · 0.45
extract_instantiationMethod · 0.45
bare_call_nameMethod · 0.45
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected