diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-06-21 21:23:08 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-06-21 21:23:08 +0100 |
commit | 072dcfe54546f87cac6485460ba453de4a228c0f (patch) | |
tree | 53d1ac235b6c5534d7ad41cf3e23c19366a942db /Src/exec.c | |
parent | b7b67d456e40183d952fa0c7793367ebbc6e320c (diff) | |
download | zsh-072dcfe54546f87cac6485460ba453de4a228c0f.tar.gz zsh-072dcfe54546f87cac6485460ba453de4a228c0f.tar.xz zsh-072dcfe54546f87cac6485460ba453de4a228c0f.zip |
Consistent use of reserved word interface for typeset.
Don't try to use array type if we have an existing hash we can use.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Src/exec.c b/Src/exec.c index 6066d5525..57e8f6376 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2543,14 +2543,26 @@ execcmd(Estate state, int input, int output, int how, int last1) checked = !has_token(cmdarg); if (!checked) break; - if (!(cflags & (BINF_BUILTIN | BINF_COMMAND)) && - (hn = shfunctab->getnode(shfunctab, cmdarg))) { - is_shfunc = 1; - break; - } - if (!(hn = builtintab->getnode(builtintab, cmdarg))) { - checked = !(cflags & BINF_BUILTIN); - break; + if (type == WC_TYPESET && + (hn = builtintab->getnode2(builtintab, cmdarg))) { + /* + * If reserved word for typeset command found (and so + * enabled), use regardless of whether builtin is + * enabled as we share the implementation. + * + * Reserved words take precedence over shell functions. + */ + checked = 1; + } else { + if (!(cflags & (BINF_BUILTIN | BINF_COMMAND)) && + (hn = shfunctab->getnode(shfunctab, cmdarg))) { + is_shfunc = 1; + break; + } + if (!(hn = builtintab->getnode(builtintab, cmdarg))) { + checked = !(cflags & BINF_BUILTIN); + break; + } } orig_cflags |= cflags; cflags &= ~BINF_BUILTIN & ~BINF_COMMAND; |