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

Method extract_function

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

Source from the content-addressed store, hash-verified

451 // --- extractors --------------------------------------------------------------
452
453 fn extract_function(&mut self, node: Node<'t>) {
454 stack_guard!();
455 // (getReceiverType only matches method_declaration's receiver field —
456 // function_declaration has none, so no reroute happens here)
457 let name = self.extract_name(node);
458 if name == "<anonymous>" {
459 if let Some(body) = node.child_by_field_name("body") {
460 self.visit_function_body(body);
461 }
462 return;
463 }
464 let extra = Extra {
465 docstring: preceding_docstring(node, self.src),
466 signature: self.signature_of(node),
467 is_exported: Some(self.is_exported(node)),
468 return_type: self.return_type_of(node),
469 ..Extra::default()
470 };
471 let Some(row) = self.create_node("function", &name, node, extra) else { return };
472 self.extract_type_annotations(node, row);
473 self.stack.push(Scope { row, kind: "function", name });
474 if let Some(body) = node.child_by_field_name("body") {
475 self.visit_function_body(body);
476 }
477 self.stack.pop();
478 }
479
480 fn extract_method(&mut self, node: Node<'t>) {
481 // methodsAreTopLevel: always a method. Receiver-qualified name +

Callers 2

visit_nodeMethod · 0.45

Calls 8

preceding_docstringFunction · 0.85
extract_nameMethod · 0.45
visit_function_bodyMethod · 0.45
signature_ofMethod · 0.45
is_exportedMethod · 0.45
return_type_ofMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected