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

Method extract_name

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

extractName — the zero-field grammar means the nameField lookup always misses; names come from the shared fallback scan (first direct identifier-family child; backtick names keep their backticks).

(&self, node: Node)

Source from the content-addressed store, hash-verified

441 /// misses; names come from the shared fallback scan (first direct
442 /// identifier-family child; backtick names keep their backticks).
443 fn extract_name(&self, node: Node) -> String {
444 if let Some(name_node) = node.child_by_field_name("simple_identifier") {
445 // nameField is a TYPE name used as a FIELD name — never resolves
446 // (mirrored for shape; the grammar has zero fields).
447 return self.text(name_node).to_string();
448 }
449 for i in 0..node.named_child_count() {
450 if let Some(c) = node.named_child(i) {
451 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
452 return self.text(c).to_string();
453 }
454 }
455 }
456 "<anonymous>".to_string()
457 }
458
459 /// getVisibility: modifiers text includes public/private/protected/
460 /// internal in that order; default PUBLIC. Text-includes semantics —

Callers 7

extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 1

textMethod · 0.45

Tested by

no test coverage detected