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

Method extract_function

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

Source from the content-addressed store, hash-verified

877 // --- extractFunction / extractMethod (:1517 / :1737) ------------------
878
879 fn extract_function(&mut self, node: Node<'t>) {
880 stack_guard!();
881 // No receiver hook. Name first (resolveName inside extract_name).
882 let name = self.extract_name(node);
883 if name == "<anonymous>" {
884 // :1549 — body-only walk (nothing pushed). Dart signatures always
885 // name; preserved for fidelity.
886 if let Some(body) = self.resolve_body(node) {
887 self.visit_body(body);
888 }
889 return;
890 }
891 // isMisparsedFunction: the unnamed constructor is skipped — node
892 // suppressed, body still walked (attributed to the current stack top).
893 if self.is_misparsed_function(node) {
894 if let Some(body) = self.resolve_body(node) {
895 self.visit_body(body);
896 }
897 return;
898 }
899 let docstring = self.docstring_of(node);
900 let signature = self.signature_of(node);
901 let visibility = self.visibility_of(node);
902 let is_async = self.is_async_of(node);
903 let is_static = self.is_static_of(node);
904 let return_type = self.return_type_of(node);
905 let body = self.resolve_body(node);
906 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
907 let row = self.create_node(
908 "function",
909 &name,
910 node,
911 Extra {
912 docstring,
913 signature,
914 visibility,
915 is_async: Some(is_async),
916 is_static: Some(is_static),
917 return_type,
918 end_line_override,
919 },
920 );
921 let Some(row) = row else { return };
922 self.extract_type_annotations(node, row);
923 self.extract_decorators_for(node, row);
924 self.stack.push(Scope { row, kind: "function", name });
925 if let Some(body) = body {
926 self.visit_body(body);
927 }
928 self.stack.pop();
929 }
930
931 fn extract_method(&mut self, node: Node<'t>) {
932 // 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