mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 17:10:59 +01:00
40640: the (A) parameter flag forces array result even if assignment syntax is not used
This commit is contained in:
parent
5a32ced1be
commit
4b8db48c6b
3 changed files with 29 additions and 2 deletions
11
Src/subst.c
11
Src/subst.c
|
|
@ -2902,6 +2902,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
|
|||
} else
|
||||
setaparam(idbeg, a);
|
||||
isarr = 1;
|
||||
arrasg = 0;
|
||||
} else {
|
||||
untokenize(val);
|
||||
setsparam(idbeg, ztrdup(val));
|
||||
|
|
@ -3784,6 +3785,16 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
|
|||
insertlinknode(l, n, dupstring(fstr)); /* appended, no incnode */
|
||||
*fstr = '\0';
|
||||
}
|
||||
if (arrasg && !isarr) {
|
||||
/*
|
||||
* Caller requested this be forced to an array even if scalar.
|
||||
* Any point in distinguishing arrasg == 2 (assoc array) here?
|
||||
*/
|
||||
l->list.flags |= LF_ARRAY;
|
||||
aval = hmkarray(val);
|
||||
isarr = 1;
|
||||
DPUTS(!val, "value is NULL in paramsubst, empty array");
|
||||
}
|
||||
if (isarr) {
|
||||
char *x;
|
||||
char *y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue