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

Method extract_function

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

Source from the content-addressed store, hash-verified

1024 // --- extractors ------------------------------------------------------------------
1025
1026 fn extract_function(&mut self, node: Node<'t>) {
1027 stack_guard!();
1028 // getReceiverType short-circuit (1522) — extension fns at any scope.
1029 if self.receiver_type_of(node).is_some() {
1030 self.extract_method(node);
1031 return;
1032 }
1033 let name = self.extract_name(node);
1034 if name == "<anonymous>" {
1035 if let Some(body) = self.resolve_body(node) {
1036 self.visit_function_body(body);
1037 }
1038 return;
1039 }
1040 let extra = Extra {
1041 docstring: preceding_docstring(node, self.src),
1042 signature: self.signature_of(node),
1043 visibility: Some(self.visibility_of(node)),
1044 is_async: Some(self.is_async(node)),
1045 is_static: Some(false), // kotlin isStatic is always false
1046 return_type: self.return_type_of(node),
1047 ..Extra::default()
1048 };
1049 let Some(row) = self.create_node("function", &name, node, extra) else { return };
1050 // extractTypeAnnotations: the generic path's field lookups all miss
1051 // (zero fields) — kotlin emits ZERO type-annotation refs.
1052 self.extract_decorators_for(node, row);
1053 self.stack.push(Scope { row, kind: "function", name });
1054 if let Some(body) = self.resolve_body(node) {
1055 self.visit_function_body(body);
1056 }
1057 self.stack.pop();
1058 }
1059
1060 fn extract_method(&mut self, node: Node<'t>) {
1061 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