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

Method extract_function

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

Source from the content-addressed store, hash-verified

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