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

Method extract_function

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

Source from the content-addressed store, hash-verified

985 // --- extractors ------------------------------------------------------------------
986
987 fn extract_function(&mut self, node: Node<'t>) {
988 stack_guard!();
989 // getReceiverType short-circuit (1522) — extension fns at any scope.
990 if self.receiver_type_of(node).is_some() {
991 self.extract_method(node);
992 return;
993 }
994 let name = self.extract_name(node);
995 if name == "<anonymous>" {
996 if let Some(body) = self.resolve_body(node) {
997 self.visit_function_body(body);
998 }
999 return;
1000 }
1001 let extra = Extra {
1002 docstring: preceding_docstring(node, self.src),
1003 signature: self.signature_of(node),
1004 visibility: Some(self.visibility_of(node)),
1005 is_async: Some(self.is_async(node)),
1006 is_static: Some(false), // kotlin isStatic is always false
1007 return_type: self.return_type_of(node),
1008 ..Extra::default()
1009 };
1010 let Some(row) = self.create_node("function", &name, node, extra) else { return };
1011 // extractTypeAnnotations: the generic path's field lookups all miss
1012 // (zero fields) — kotlin emits ZERO type-annotation refs.
1013 self.extract_decorators_for(node, row);
1014 self.stack.push(Scope { row, kind: "function", name });
1015 if let Some(body) = self.resolve_body(node) {
1016 self.visit_function_body(body);
1017 }
1018 self.stack.pop();
1019 }
1020
1021 fn extract_method(&mut self, node: Node<'t>) {
1022 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 13

preceding_docstringFunction · 0.85
pushMethod · 0.80
receiver_type_ofMethod · 0.45
extract_methodMethod · 0.45
extract_nameMethod · 0.45
resolve_bodyMethod · 0.45
visit_function_bodyMethod · 0.45
signature_ofMethod · 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