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

Method lua_assignment_target

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

Source from the content-addressed store, hash-verified

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