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

Method extract_function

codegraph-kernel/src/java.rs:634–659  ·  view source on GitHub ↗

extractFunction — only reachable for a method outside any class.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

632
633 /// extractFunction — only reachable for a method outside any class.
634 fn extract_function(&mut self, node: Node<'t>) {
635 stack_guard!();
636 let name = self.extract_name(node);
637 if name == "<anonymous>" {
638 if let Some(body) = node.child_by_field_name("body") {
639 self.visit_function_body(body);
640 }
641 return;
642 }
643 let extra = Extra {
644 docstring: preceding_docstring(node, self.src),
645 signature: self.signature_of(node),
646 visibility: self.visibility_of(node),
647 is_static: Some(self.is_static(node)),
648 return_type: self.normalize_java_type(node.child_by_field_name("type")),
649 ..Extra::default()
650 };
651 let Some(row) = self.create_node("function", &name, node, extra) else { return };
652 self.extract_type_annotations(node, row);
653 self.extract_decorators_for(node, row);
654 self.stack.push(Scope { row, kind: "function", name });
655 if let Some(body) = node.child_by_field_name("body") {
656 self.visit_function_body(body);
657 }
658 self.stack.pop();
659 }
660
661 fn extract_interface(&mut self, node: Node<'t>) {
662 stack_guard!();

Callers 1

extract_methodMethod · 0.45

Calls 10

preceding_docstringFunction · 0.85
normalize_java_typeMethod · 0.80
extract_nameMethod · 0.45
visit_function_bodyMethod · 0.45
signature_ofMethod · 0.45
visibility_ofMethod · 0.45
is_staticMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected