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

Method extract_function

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

Source from the content-addressed store, hash-verified

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