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

Method extract_name

codegraph-kernel/src/lua.rs:363–386  ·  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

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

textMethod · 0.45

Tested by

no test coverage detected