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

Method lua_assignment_target

codegraph-kernel/src/lua.rs:628–653  ·  view source on GitHub ↗
(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

626 }
627
628 fn lua_assignment_target(&self, node: Node<'t>) -> Option<(String, Option<String>, String)> {
629 if node.kind() == "identifier" {
630 let name = self.text(node).trim().to_string();
631 if name.is_empty() {
632 return None;
633 }
634 return Some((name.clone(), None, name));
635 }
636 if !matches!(
637 node.kind(),
638 "dot_index_expression" | "method_index_expression" | "bracket_index_expression"
639 ) {
640 return None;
641 }
642 let table = node.child_by_field_name("table")?;
643 let field = node
644 .child_by_field_name("field")
645 .or_else(|| node.child_by_field_name("method"))?;
646 let receiver = self.text(table).trim().to_string();
647 let name = self.lua_static_field_name(field, node.kind() == "bracket_index_expression");
648 if receiver.is_empty() || name.is_empty() {
649 return None;
650 }
651 let full_name = format!("{receiver}.{name}");
652 Some((name, Some(receiver), full_name))
653 }
654
655 fn lua_static_field_name(&self, node: Node<'t>, bracketed: bool) -> String {
656 if node.kind() == "identifier" {

Callers 1

extract_variableMethod · 0.80

Calls 2

lua_static_field_nameMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected