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

Method extract_name

codegraph-kernel/src/rustlang.rs:343–355  ·  view source on GitHub ↗

extractName — nameField `name`, else the identifier-like child scan.

(&self, node: Node)

Source from the content-addressed store, hash-verified

341
342 /// extractName — nameField `name`, else the identifier-like child scan.
343 fn extract_name(&self, node: Node) -> String {
344 if let Some(name_node) = node.child_by_field_name("name") {
345 return self.text(name_node).to_string();
346 }
347 for i in 0..node.named_child_count() {
348 if let Some(c) = node.named_child(i) {
349 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
350 return self.text(c).to_string();
351 }
352 }
353 }
354 "<anonymous>".to_string()
355 }
356
357 /// rustExtractor.getSignature: raw params text + ` -> ` + raw return type.
358 fn signature_of(&self, node: Node) -> Option<String> {

Callers 6

extract_fn_or_methodMethod · 0.45
extract_interfaceMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 1

textMethod · 0.45

Tested by

no test coverage detected