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

Method extract_function

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

Source from the content-addressed store, hash-verified

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