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

Method extract_name

codegraph-kernel/src/lua.rs:364–387  ·  view source on GitHub ↗

extractName (tree-sitter.ts:98-192) — the lua-reachable branches.

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

362
363 /// extractName (tree-sitter.ts:98-192) — the lua-reachable branches.
364 fn extract_name(&self, node: Node<'t>) -> String {
365 if let Some(name_node) = node.child_by_field_name("name") {
366 // Lua: dot/method index → the trailing field/method segment.
367 if name_node.kind() == "dot_index_expression" {
368 if let Some(f) = name_node.child_by_field_name("field") {
369 return self.text(f).to_string();
370 }
371 }
372 if name_node.kind() == "method_index_expression" {
373 if let Some(m) = name_node.child_by_field_name("method") {
374 return self.text(m).to_string();
375 }
376 }
377 return self.text(name_node).to_string();
378 }
379 // Fallback: first identifier-ish named child.
380 let mut cursor = node.walk();
381 for c in node.named_children(&mut cursor) {
382 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
383 return self.text(c).to_string();
384 }
385 }
386 "<anonymous>".to_string()
387 }
388
389 /// getSignature — lua (lua.ts:83-86) / luau (luau.ts:26-35).
390 fn signature_of(&self, node: Node<'t>) -> Option<String> {

Callers 3

extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 2

walkMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected