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

Method extract_method

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

Source from the content-addressed store, hash-verified

1002 }
1003
1004 fn extract_method(&mut self, node: Node<'t>) {
1005 // Gate (:1747): not inside class-like (no methodsAreTopLevel, no
1006 // receiver, parent never object/object_expression) → extractFunction.
1007 if !self.inside_class_like() {
1008 self.extract_function(node);
1009 return;
1010 }
1011 let name = self.extract_name(node);
1012 // isMisparsedFunction — the unnamed ctor: body-only walk.
1013 if self.is_misparsed_function(node) {
1014 if let Some(body) = self.resolve_body(node) {
1015 self.visit_body(body);
1016 }
1017 return;
1018 }
1019 let docstring = self.docstring_of(node);
1020 let signature = self.signature_of(node);
1021 let visibility = self.visibility_of(node);
1022 let is_async = self.is_async_of(node);
1023 let is_static = self.is_static_of(node);
1024 let return_type = self.return_type_of(node);
1025 let body = self.resolve_body(node);
1026 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
1027 // Operators mint method "<anonymous>" — extractMethod has NO skip.
1028 let row = self.create_node(
1029 "method",
1030 &name,
1031 node,
1032 Extra {
1033 docstring,
1034 signature,
1035 visibility,
1036 is_async: Some(is_async),
1037 is_static: Some(is_static),
1038 return_type,
1039 end_line_override,
1040 },
1041 );
1042 let Some(row) = row else { return };
1043 self.extract_type_annotations(node, row);
1044 self.extract_decorators_for(node, row);
1045 self.stack.push(Scope { row, kind: "method", name });
1046 if let Some(body) = body {
1047 self.visit_body(body);
1048 }
1049 self.stack.pop();
1050 }
1051
1052 // --- extractClass (:1679) — classes, mixins, extensions ---------------
1053

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