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

Method extract_function

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

Source from the content-addressed store, hash-verified

393 // --- extractors --------------------------------------------------------------
394
395 fn extract_function(&mut self, node: Node<'t>) {
396 stack_guard!();
397 let name = self.extract_name(node);
398 if name == "<anonymous>" {
399 if let Some(body) = node.child_by_field_name("body") {
400 self.visit_function_body(body);
401 }
402 return;
403 }
404 let extra = Extra {
405 docstring: preceding_docstring(node, self.src),
406 signature: self.signature_of(node),
407 is_async: Some(self.is_async(node)),
408 is_static: Some(self.is_static(node)),
409 };
410 let Some(row) = self.create_node("function", &name, node, extra) else { return };
411 // (python is not a TYPE_ANNOTATION language — no type refs)
412 self.extract_decorators_for(node, row);
413 self.stack.push(Scope { row, kind: "function", name });
414 if let Some(body) = node.child_by_field_name("body") {
415 self.visit_function_body(body);
416 }
417 self.stack.pop();
418 }
419
420 fn extract_method(&mut self, node: Node<'t>) {
421 stack_guard!();

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_asyncMethod · 0.45
is_staticMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected