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

Method extract_function

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

Source from the content-addressed store, hash-verified

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