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

Method extract_method

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

Source from the content-addressed store, hash-verified

600 }
601
602 fn extract_method(&mut self, node: Node<'t>) {
603 if !self.inside_class_like() {
604 // (object-literal parents don't exist in Java; a stray top-level
605 // method extracts as a function, mirroring extractMethod's tail)
606 self.extract_function(node);
607 return;
608 }
609 let name = self.extract_name(node);
610 let extra = Extra {
611 docstring: preceding_docstring(node, self.src),
612 signature: self.signature_of(node),
613 visibility: self.visibility_of(node),
614 is_static: Some(self.is_static(node)),
615 return_type: self.normalize_java_type(node.child_by_field_name("type")),
616 ..Extra::default()
617 };
618 let Some(row) = self.create_node("method", &name, node, extra) else { return };
619 self.extract_type_annotations(node, row);
620 self.extract_decorators_for(node, row);
621 self.stack.push(Scope { row, kind: "method", name });
622 if let Some(body) = node.child_by_field_name("body") {
623 self.visit_function_body(body);
624 }
625 self.stack.pop();
626 }
627
628 /// extractFunction — only reachable for a method outside any class.
629 fn extract_function(&mut self, node: Node<'t>) {

Callers 1

visit_nodeMethod · 0.45

Calls 12

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

Tested by

no test coverage detected