From 2bec57991f7c7d6acf1ae5cb92e751b9ff08cc91 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 13 Oct 2026 21:33:50 +0200 Subject: xixanta: add Context.full_name() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/object.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/xixanta/src/object.rs') diff --git a/lib/xixanta/src/object.rs b/lib/xixanta/src/object.rs index 5a90a3d..36dcd89 100644 --- a/lib/xixanta/src/object.rs +++ b/lib/xixanta/src/object.rs @@ -548,6 +548,16 @@ impl Context { } } + /// Returns the full name of the given variable 'name'. That is, it prepends + /// the name of the context unless the variable resides in the global + /// context. + pub fn full_name(&self, name: &str) -> String { + match self.stack.last() { + Some(context_name) => format!("{context_name}::{name}"), + None => name.to_string(), + } + } + /// Returns true if we are in the global scope. pub fn is_global(&self) -> bool { self.stack.is_empty() -- cgit v1.2.3