aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.h
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-07-12 01:45:52 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-07-12 14:07:55 -0700
commit2eb65b362518fe3407fa6fd759927ef3136ad0a6 (patch)
tree4a464368a00bb7d1565758735c417cc8497da5c9 /env.h
parent76fdfe6890ece17c7b54f51f320432bcb3e38c2f (diff)
set: Don't treat toplevel scope the same as global
When using the `set` command with the -l flag, if we're at the top level, create a temporary local scope. This makes query/assignment behavior be consistent with the value-printing behavior. This works by marking the current block as needing to pop the environment if a local scope was pushed. I assume this is safe to do. I also assume the current block is the right one to modify, rather than trying to walk up the stack to the root.
Diffstat (limited to 'env.h')
-rw-r--r--env.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/env.h b/env.h
index d1a40f7d..e886a5b2 100644
--- a/env.h
+++ b/env.h
@@ -199,6 +199,12 @@ void env_push(bool new_scope);
*/
void env_pop();
+/**
+ Push the variable stack if the current scope is the global scope. Returns
+ whether it pushed a scope.
+*/
+bool env_ensure_local_scope();
+
/** Synchronizes all universal variable changes: writes everything out, reads stuff in */
void env_universal_barrier();