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

Method extract_function

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

Source from the content-addressed store, hash-verified

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