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

Method extract_method

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

Source from the content-addressed store, hash-verified

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