summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-06-07 10:02:14 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2022-06-07 10:02:14 +0100
commitb26b6b3fe00b94a2d4370b1afd2644034947b6b8 (patch)
treed29604d25defe18200cfe049d0042efd7643a865 /Src
parenta99f96797f5fc424554a94313dfc0d4a5b0923a1 (diff)
downloadzsh-b26b6b3fe00b94a2d4370b1afd2644034947b6b8.tar.gz
zsh-b26b6b3fe00b94a2d4370b1afd2644034947b6b8.zip
Tweaks to MULTI_FUNC_DEF
Output multiple function definitions using "function" form. Note exceptions to errors with NO_MULTI_FUNC_DEF
Diffstat (limited to 'Src')
-rw-r--r--Src/text.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Src/text.c b/Src/text.c
index 5cd7685fd..56127c457 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -578,11 +578,16 @@ gettext2(Estate state)
Wordcode end = p + WC_FUNCDEF_SKIP(code);
int nargs = *state->pc++;
+ if (nargs > 1)
+ taddstr("function ");
taddlist(state, nargs);
if (nargs)
taddstr(" ");
if (tjob) {
- taddstr("() { ... }");
+ if (nargs > 1)
+ taddstr("{ ... }");
+ else
+ taddstr("() { ... }");
state->pc = end;
if (!nargs) {
/*
@@ -594,7 +599,10 @@ gettext2(Estate state)
}
stack = 1;
} else {
- taddstr("() {");
+ if (nargs > 1)
+ taddstr("{");
+ else
+ taddstr("() {");
tindent++;
taddnl(1);
n = tpush(code, 1);