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

Method extract_function

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

Source from the content-addressed store, hash-verified

954 // --- extractFunction / extractMethod (:1517 / :1737) ------------------
955
956 fn extract_function(&mut self, node: Node<'t>) {
957 stack_guard!();
958 // No receiver hook. Name first (resolveName inside extract_name).
959 let name = self.extract_name(node);
960 if name == "<anonymous>" {
961 // :1549 — body-only walk (nothing pushed). Dart signatures always
962 // name; preserved for fidelity.
963 if let Some(body) = self.resolve_body(node) {
964 self.visit_body(body);
965 }
966 return;
967 }
968 // isMisparsedFunction: the unnamed constructor is skipped — node
969 // suppressed, body still walked (attributed to the current stack top).
970 if self.is_misparsed_function(node) {
971 if let Some(body) = self.resolve_body(node) {
972 self.visit_body(body);
973 }
974 return;
975 }
976 let docstring = self.docstring_of(node);
977 let signature = self.signature_of(node);
978 let visibility = self.visibility_of(node);
979 let is_async = self.is_async_of(node);
980 let is_static = self.is_static_of(node);
981 let return_type = self.return_type_of(node);
982 let body = self.resolve_body(node);
983 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
984 let row = self.create_node(
985 "function",
986 &name,
987 node,
988 Extra {
989 docstring,
990 signature,
991 visibility,
992 is_async: Some(is_async),
993 is_static: Some(is_static),
994 return_type,
995 end_line_override,
996 },
997 );
998 let Some(row) = row else { return };
999 self.extract_type_annotations(node, row);
1000 self.extract_decorators_for(node, row);
1001 self.stack.push(Scope { row, kind: "function", name });
1002 if let Some(body) = body {
1003 self.visit_body(body);
1004 }
1005 self.stack.pop();
1006 }
1007
1008 fn extract_method(&mut self, node: Node<'t>) {
1009 // Gate (:1747): not inside class-like (no methodsAreTopLevel, no

Callers 3

visitMethod · 0.45
extract_methodMethod · 0.45
visit_bodyMethod · 0.45

Calls 15

is_async_ofMethod · 0.80
mapMethod · 0.80
pushMethod · 0.80
extract_nameMethod · 0.45
resolve_bodyMethod · 0.45
visit_bodyMethod · 0.45
is_misparsed_functionMethod · 0.45
docstring_ofMethod · 0.45
signature_ofMethod · 0.45
visibility_ofMethod · 0.45
is_static_ofMethod · 0.45
return_type_ofMethod · 0.45

Tested by

no test coverage detected