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

Method signature_of

codegraph-kernel/src/kotlin.rs:634–660  ·  view source on GitHub ↗

`(params): ReturnType` — the positional read TreeSitterExtractor's kotlin getSignature does (#1495): the `function_value_parameters` child, then the type node that follows it before the body. Verbatim source text, so it round-trips through parity byte-for-byte.

(&self, node: Node)

Source from the content-addressed store, hash-verified

632 /// then the type node that follows it before the body. Verbatim source text,
633 /// so it round-trips through parity byte-for-byte.
634 fn signature_of(&self, node: Node) -> Option<String> {
635 let mut params: Option<Node> = None;
636 let mut return_type: Option<Node> = None;
637 for child in node.named_children(&mut node.walk()) {
638 if child.kind() == "function_value_parameters" {
639 params = Some(child);
640 continue;
641 }
642 if params.is_none() {
643 continue;
644 }
645 if matches!(child.kind(), "function_body" | "type_constraints") {
646 break;
647 }
648 if matches!(child.kind(), "user_type" | "nullable_type" | "function_type") {
649 return_type = Some(child);
650 break;
651 }
652 }
653 let params = params?;
654 let mut sig = self.text(params).to_string();
655 if let Some(rt) = return_type {
656 sig.push_str(": ");
657 sig.push_str(self.text(rt));
658 }
659 Some(sig)
660 }
661
662 /// extractKotlinReturnType — positional: the first user_type/nullable_type
663 /// AFTER function_value_parameters; function_body/type_constraints first →

Callers 2

extract_functionMethod · 0.45
extract_methodMethod · 0.45

Calls 2

textMethod · 0.65
walkMethod · 0.45

Tested by

no test coverage detected