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

Method extract_function

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

Source from the content-addressed store, hash-verified

670 // --- extractFunction / extractMethod (:1517 / :1737) ------------------
671
672 fn extract_function(&mut self, node: Node<'t>) {
673 stack_guard!();
674 // No receiver hook. Name first (resolveName inside extract_name).
675 let name = self.extract_name(node);
676 if name == "<anonymous>" {
677 // :1549 — body-only walk (nothing pushed). Dart signatures always
678 // name; preserved for fidelity.
679 if let Some(body) = self.resolve_body(node) {
680 self.visit_body(body);
681 }
682 return;
683 }
684 // isMisparsedFunction: the unnamed constructor is skipped — node
685 // suppressed, body still walked (attributed to the current stack top).
686 if self.is_unnamed_ctor(node) {
687 if let Some(body) = self.resolve_body(node) {
688 self.visit_body(body);
689 }
690 return;
691 }
692 let docstring = preceding_docstring(node, self.src);
693 let signature = self.signature_of(node);
694 let visibility = self.visibility_of(node);
695 let is_async = self.is_async_of(node);
696 let is_static = self.is_static_of(node);
697 let return_type = self.return_type_of(node);
698 let body = self.resolve_body(node);
699 let end_line_override = body.map(|b| b.end_position().row as u32 + 1);
700 let row = self.create_node(
701 "function",
702 &name,
703 node,
704 Extra {
705 docstring,
706 signature,
707 visibility,
708 is_async: Some(is_async),
709 is_static: Some(is_static),
710 return_type,
711 end_line_override,
712 },
713 );
714 let Some(row) = row else { return };
715 self.extract_type_annotations(node, row);
716 self.extract_decorators_for(node, row);
717 self.stack.push(Scope { row, kind: "function", name });
718 if let Some(body) = body {
719 self.visit_body(body);
720 }
721 self.stack.pop();
722 }
723
724 fn extract_method(&mut self, node: Node<'t>) {
725 // Gate (:1747): not inside class-like (no methodsAreTopLevel, no

Callers 3

visitMethod · 0.45
extract_methodMethod · 0.45
visit_bodyMethod · 0.45

Calls 13

preceding_docstringFunction · 0.85
is_unnamed_ctorMethod · 0.80
is_async_ofMethod · 0.80
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
create_nodeMethod · 0.45

Tested by

no test coverage detected