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

Method extract_name

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

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

(&self, node: Node)

Source from the content-addressed store, hash-verified

354
355 /// extractName — nameField `name`, else the identifier-like child scan.
356 fn extract_name(&self, node: Node) -> String {
357 if let Some(name_node) = node.child_by_field_name("name") {
358 return self.text(name_node).to_string();
359 }
360 for i in 0..node.named_child_count() {
361 if let Some(c) = node.named_child(i) {
362 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
363 return self.text(c).to_string();
364 }
365 }
366 }
367 "<anonymous>".to_string()
368 }
369
370 /// rustExtractor.getSignature: raw params text + ` -> ` + raw return type.
371 fn signature_of(&self, node: Node) -> Option<String> {

Callers 6

extract_fn_or_methodMethod · 0.45
extract_interfaceMethod · 0.45
extract_aggregateMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 1

textMethod · 0.65

Tested by

no test coverage detected