summaryrefslogtreecommitdiff
path: root/Src/zsh.h
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-01-23 09:50:57 +0000
committerPeter Stephenson <pws@zsh.org>2017-01-23 09:50:57 +0000
commitc861b17bbf002129f29e22ab625fd3516ba792a2 (patch)
treed1cd26c6a1f298840fd51fae19a4a25f279ecf10 /Src/zsh.h
parent8cb130fe7311aa428e93978eeceb5ab141959aa6 (diff)
downloadzsh-c861b17bbf002129f29e22ab625fd3516ba792a2.tar.gz
zsh-c861b17bbf002129f29e22ab625fd3516ba792a2.zip
40391: Add WARN_NESTED_VAR option and functions -W.
These are companions to WARN_CREATED_GLOBAL, warning when a variable from an enclosing scope is altered.
Diffstat (limited to 'Src/zsh.h')
-rw-r--r--Src/zsh.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Src/zsh.h b/Src/zsh.h
index 7d18333be..d0222605b 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1815,6 +1815,7 @@ struct tieddata {
#define PM_HIDE (1<<14) /* Special behaviour hidden by local */
#define PM_CUR_FPATH (1<<14) /* (function): can use $fpath with filename */
#define PM_HIDEVAL (1<<15) /* Value not shown in `typeset' commands */
+#define PM_WARNNESTED (1<<15) /* (function): non-recursive WARNNESTEDVAR */
#define PM_TIED (1<<16) /* array tied to colon-path or v.v. */
#define PM_TAGGED_LOCAL (1<<16) /* (function): non-recursive PM_TAGGED */
@@ -2016,9 +2017,15 @@ struct paramdef {
* Flags for assignsparam and assignaparam.
*/
enum {
+ /* Add to rather than override value */
ASSPM_AUGMENT = 1 << 0,
+ /* Test for warning if creating global variable in function */
ASSPM_WARN_CREATE = 1 << 1,
- ASSPM_ENV_IMPORT = 1 << 2
+ /* Test for warning if using nested variable in function */
+ ASSPM_WARN_NESTED = 1 << 2,
+ ASSPM_WARN = (ASSPM_WARN_CREATE|ASSPM_WARN_NESTED),
+ /* Import from environment, so exercise care evaluating value */
+ ASSPM_ENV_IMPORT = 1 << 3,
};
/* node for named directory hash table (nameddirtab) */
@@ -2400,6 +2407,7 @@ enum {
VERBOSE,
VIMODE,
WARNCREATEGLOBAL,
+ WARNNESTEDVAR,
XTRACE,
USEZLE,
DVORAK,