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

Method extract_function

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

Source from the content-addressed store, hash-verified

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

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