diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/exec.c | 21 | ||||
-rw-r--r-- | Test/B02typeset.ztst | 13 |
3 files changed, 30 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index 574e5fa73..b2d01f34a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 Peter Stephenson <p.stephenson@samsung.com> + + * 35604: Src/exec.c, Test/B02typeset: create + empty arrays in typeset with array=(). + 2015-06-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> * 35550: Src/Zle/complist.c: fix backspace in interactive diff --git a/Src/exec.c b/Src/exec.c index 57e8f6376..50a11eb54 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3583,15 +3583,18 @@ execcmd(Estate state, int input, int output, int how, int last1) asg->value.array = ecgetlist(state, WC_ASSIGN_NUM(ac), EC_DUPTOK, &htok); - prefork(asg->value.array, PREFORK_ASSIGN); - if (errflag) { - state->pc = opc; - break; - } - globlist(asg->value.array, 0); - if (errflag) { - state->pc = opc; - break; + if (asg->value.array) + { + prefork(asg->value.array, PREFORK_ASSIGN); + if (errflag) { + state->pc = opc; + break; + } + globlist(asg->value.array, 0); + if (errflag) { + state->pc = opc; + break; + } } } diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index e6285bc05..1548b817b 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -663,3 +663,16 @@ >fn2 () { > typeset assignfirst=(why not) >} + + fn() { + typeset array=() + print ${(t)array} ${#array} + typeset gnothergarray=() gnothergarray[1]=yes gnothergarray[2]=no + print -l ${(t)gnothergarray} $gnothergarray + } + fn +0:can set empty array +>array-local 0 +>array-local +>yes +>no |