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

Method extract_method

codegraph-kernel/src/tsjs/extractors.rs:520–560  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

518 // --- extractMethod -------------------------------------------------------------
519
520 pub(super) fn extract_method(&mut self, node: Node<'t>) {
521 if !self.inside_class_like() {
522 // Object-literal methods are ephemeral: walk the body only.
523 if let Some(parent) = node.parent() {
524 if matches!(parent.kind(), "object" | "object_expression") {
525 let body = body_of(node);
526 self.visit_parameter_defaults(node, body);
527 if let Some(body) = body {
528 self.visit_function_body(body);
529 }
530 return;
531 }
532 }
533 self.extract_function(node, None);
534 return;
535 }
536
537 let name = self.extract_name(node);
538 let extra = Extra {
539 docstring: crate::docstring::preceding_docstring(node, self.src),
540 signature: self.signature_of(node),
541 visibility: self.visibility_of(node),
542 is_async: Some(self.is_async(node)),
543 is_static: self.is_static(node),
544 ..Extra::default() // methods carry no isExported (mirrors extractMethod)
545 };
546 let Some(row) = self.create_node("method", &name, node, extra) else {
547 return;
548 };
549
550 self.extract_type_annotations(node, row);
551 self.extract_decorators_for(node, row);
552
553 self.stack.push(Scope { row, kind: "method", name });
554 let body = body_of(node);
555 self.visit_parameter_defaults(node, body);
556 if let Some(body) = body {
557 self.visit_function_body(body);
558 }
559 self.stack.pop();
560 }
561
562 // --- extractInterface / extractEnum / members -----------------------------------
563

Callers 1

visit_nodeMethod · 0.45

Calls 15

body_ofFunction · 0.85
preceding_docstringFunction · 0.85
pushMethod · 0.80
inside_class_likeMethod · 0.45
visit_function_bodyMethod · 0.45
extract_functionMethod · 0.45
extract_nameMethod · 0.45
signature_ofMethod · 0.45
visibility_ofMethod · 0.45
is_asyncMethod · 0.45
is_staticMethod · 0.45

Tested by

no test coverage detected