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

Method extract_method

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

Source from the content-addressed store, hash-verified

720 }
721
722 fn extract_method(&mut self, node: Node<'t>) {
723 // Gate (:1747): not inside class-like (no methodsAreTopLevel, no
724 // receiver, parent never object/object_expression) → extractFunction.
725 if !self.inside_class_like() {
726 self.extract_function(node);
727 return;
728 }
729 let name = self.extract_name(node);
730 // isMisparsedFunction — the unnamed ctor: body-only walk.
731 if self.is_unnamed_ctor(node) {
732 if let Some(body) = self.resolve_body(node) {
733 self.visit_body(body);
734 }
735 return;
736 }
737 let docstring = preceding_docstring(node, self.src);
738 let signature = self.signature_of(node);
739 let visibility = self.visibility_of(node);
740 let is_async = self.is_async_of(node);
741 let is_static = self.is_static_of(node);
742 let return_type = self.return_type_of(node);
743 let body = self.resolve_body(node);
744 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
745 // Operators mint method "<anonymous>" — extractMethod has NO skip.
746 let row = self.create_node(
747 "method",
748 &name,
749 node,
750 Extra {
751 docstring,
752 signature,
753 visibility,
754 is_async: Some(is_async),
755 is_static: Some(is_static),
756 return_type,
757 end_line_override,
758 },
759 );
760 let Some(row) = row else { return };
761 self.extract_type_annotations(node, row);
762 self.extract_decorators_for(node, row);
763 self.stack.push(Scope { row, kind: "method", name });
764 if let Some(body) = body {
765 self.visit_body(body);
766 }
767 self.stack.pop();
768 }
769
770 // --- extractClass (:1679) — classes, mixins, extensions ---------------
771

Callers 1

visitMethod · 0.45

Calls 15

preceding_docstringFunction · 0.85
is_unnamed_ctorMethod · 0.80
is_async_ofMethod · 0.80
inside_class_likeMethod · 0.45
extract_functionMethod · 0.45
extract_nameMethod · 0.45
resolve_bodyMethod · 0.45
visit_bodyMethod · 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