From 8ff278a383601e7370f40737b263f39606d3ba1c Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 9 Mar 2026 22:44:01 +0100 Subject: Ignore GLOBAL_CONTEXT on force_context_switch() 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 | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/xixanta/src/object.rs') diff --git a/lib/xixanta/src/object.rs b/lib/xixanta/src/object.rs index c16ddb0..5b4b235 100644 --- a/lib/xixanta/src/object.rs +++ b/lib/xixanta/src/object.rs @@ -398,6 +398,12 @@ impl Context { // Clear the context stack as we will set it manually. self.stack.truncate(0); + // If the given name turns out to be just the global one, skip the push + // for the stack. + if name == GLOBAL_CONTEXT { + return; + } + // Forcing a context switch is not as simple as pushing the given name, // but we have to make sure that the whole scope hierarchy is laid out // so the code that fetches variables continues to work (e.g. if -- cgit v1.2.3