aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/object.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xixanta/src/object.rs')
-rw-r--r--lib/xixanta/src/object.rs10
1 files changed, 10 insertions, 0 deletions
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()