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

Method extract_function

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

Source from the content-addressed store, hash-verified

777 // --- extractors ------------------------------------------------------------------
778
779 fn extract_function(&mut self, node: Node<'t>) {
780 // getReceiverType short-circuit (1522) — extension fns at any scope.
781 if self.receiver_type_of(node).is_some() {
782 self.extract_method(node);
783 return;
784 }
785 let name = self.extract_name(node);
786 if name == "<anonymous>" {
787 if let Some(body) = self.resolve_body(node) {
788 self.visit_function_body(body);
789 }
790 return;
791 }
792 let extra = Extra {
793 docstring: preceding_docstring(node, self.src),
794 signature: None, // dead hook (zero fields)
795 visibility: Some(self.visibility_of(node)),
796 is_async: Some(self.is_async(node)),
797 is_static: Some(false), // kotlin isStatic is always false
798 return_type: self.return_type_of(node),
799 ..Extra::default()
800 };
801 let Some(row) = self.create_node("function", &name, node, extra) else { return };
802 // extractTypeAnnotations: the generic path's field lookups all miss
803 // (zero fields) — kotlin emits ZERO type-annotation refs.
804 self.extract_decorators_for(node, row);
805 self.stack.push(Scope { row, kind: "function", name });
806 if let Some(body) = self.resolve_body(node) {
807 self.visit_function_body(body);
808 }
809 self.stack.pop();
810 }
811
812 fn extract_method(&mut self, node: Node<'t>) {
813 let receiver = self.receiver_type_of(node);

Callers 2

visit_nodeMethod · 0.45

Calls 11

preceding_docstringFunction · 0.85
receiver_type_ofMethod · 0.45
extract_methodMethod · 0.45
extract_nameMethod · 0.45
resolve_bodyMethod · 0.45
visit_function_bodyMethod · 0.45
visibility_ofMethod · 0.45
is_asyncMethod · 0.45
return_type_ofMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected