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

Method extract_method

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

Source from the content-addressed store, hash-verified

929 }
930
931 fn extract_method(&mut self, node: Node<'t>) {
932 // Gate (:1747): not inside class-like (no methodsAreTopLevel, no
933 // receiver, parent never object/object_expression) → extractFunction.
934 if !self.inside_class_like() {
935 self.extract_function(node);
936 return;
937 }
938 let name = self.extract_name(node);
939 // isMisparsedFunction — the unnamed ctor: body-only walk.
940 if self.is_misparsed_function(node) {
941 if let Some(body) = self.resolve_body(node) {
942 self.visit_body(body);
943 }
944 return;
945 }
946 let docstring = self.docstring_of(node);
947 let signature = self.signature_of(node);
948 let visibility = self.visibility_of(node);
949 let is_async = self.is_async_of(node);
950 let is_static = self.is_static_of(node);
951 let return_type = self.return_type_of(node);
952 let body = self.resolve_body(node);
953 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
954 // Operators mint method "<anonymous>" — extractMethod has NO skip.
955 let row = self.create_node(
956 "method",
957 &name,
958 node,
959 Extra {
960 docstring,
961 signature,
962 visibility,
963 is_async: Some(is_async),
964 is_static: Some(is_static),
965 return_type,
966 end_line_override,
967 },
968 );
969 let Some(row) = row else { return };
970 self.extract_type_annotations(node, row);
971 self.extract_decorators_for(node, row);
972 self.stack.push(Scope { row, kind: "method", name });
973 if let Some(body) = body {
974 self.visit_body(body);
975 }
976 self.stack.pop();
977 }
978
979 // --- extractClass (:1679) — classes, mixins, extensions ---------------
980

Callers 1

visitMethod · 0.45

Calls 15

is_async_ofMethod · 0.80
mapMethod · 0.80
pushMethod · 0.80
inside_class_likeMethod · 0.45
extract_functionMethod · 0.45
extract_nameMethod · 0.45
is_misparsed_functionMethod · 0.45
resolve_bodyMethod · 0.45
visit_bodyMethod · 0.45
docstring_ofMethod · 0.45
signature_ofMethod · 0.45
visibility_ofMethod · 0.45

Tested by

no test coverage detected