mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-18 09:41:09 +02:00
52645: unset through a nameref keep up-scope parameters declared unset
Othewise unset of a reference to a global wipes out all parameters of the same name.
This commit is contained in:
parent
85172998f4
commit
13f73d84d3
2 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2024-03-01 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 52645: Src/builtin.c: unset through a nameref keep up-scope
|
||||
parameters declared, and not wipe out the entire parameter stack
|
||||
|
||||
2024-02-28 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 52619 (plus tests): Src/params.c, Test/A06assign.ztst: there
|
||||
|
|
|
@ -3932,8 +3932,14 @@ bin_unset(char *name, char **argv, Options ops, int func)
|
|||
}
|
||||
} else {
|
||||
if (!OPT_ISSET(ops,'n')) {
|
||||
int ref = (pm->node.flags & PM_NAMEREF);
|
||||
if (!(pm = (Param)resolve_nameref(pm, NULL)))
|
||||
continue;
|
||||
if (ref && pm->level < locallevel) {
|
||||
/* Just mark unset, do not remove from table */
|
||||
pm->node.flags |= PM_DECLARED|PM_UNSET;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (unsetparam_pm(pm, 0, 1))
|
||||
returnval = 1;
|
||||
|
|
Loading…
Reference in a new issue