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

Method extract_name

codegraph-kernel/src/csharp.rs:499–511  ·  view source on GitHub ↗

extractName (tree-sitter.ts:90) — the C#-reachable paths: the `name` field (always present on named declarations), else the shared identifier scan, else ` `.

(&self, node: Node)

Source from the content-addressed store, hash-verified

497 /// field (always present on named declarations), else the shared
498 /// identifier scan, else `<anonymous>`.
499 fn extract_name(&self, node: Node) -> String {
500 if let Some(name_node) = node.child_by_field_name("name") {
501 return self.text(name_node).to_string();
502 }
503 for i in 0..node.named_child_count() {
504 if let Some(c) = node.named_child(i) {
505 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
506 return self.text(c).to_string();
507 }
508 }
509 }
510 "<anonymous>".to_string()
511 }
512
513 // --- the dispatcher (visitNode, C#-relevant branches) -----------------------
514

Callers 7

extract_classMethod · 0.45
extract_structMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
extract_methodMethod · 0.45
extract_functionMethod · 0.45
extract_variableMethod · 0.45

Calls 1

textMethod · 0.65

Tested by

no test coverage detected