From c861b17bbf002129f29e22ab625fd3516ba792a2 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 23 Jan 2017 09:50:57 +0000 Subject: 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. --- Src/zsh.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Src/zsh.h') 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, -- cgit 1.4.1