about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-02-12 19:48:50 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-02-12 19:48:50 +0000
commit7e6faf7237b1862fce3ebc34f09ee9ac07940638 (patch)
treecbe81d8d2469253401213aa063aa7abc501244d9 /Src
parentae7dcab5ed1882b6115c9fe3ab7894a8b6a7e9eb (diff)
downloadzsh-7e6faf7237b1862fce3ebc34f09ee9ac07940638.tar.gz
zsh-7e6faf7237b1862fce3ebc34f09ee9ac07940638.tar.xz
zsh-7e6faf7237b1862fce3ebc34f09ee9ac07940638.zip
34519: $_ for arguments of anonymous function
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 3b0e936b4..302e2b510 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4456,7 +4456,7 @@ execfuncdef(Estate state, Eprog redir_prog)
 	if (!names) {
 	    /*
 	     * Anonymous function, execute immediately.
-	     * Function name is "(anon)", parameter list is empty.
+	     * Function name is "(anon)".
 	     */
 	    LinkList args;
 
@@ -4477,6 +4477,9 @@ execfuncdef(Estate state, Eprog redir_prog)
 		}
 	    }
 
+	    setunderscore((args && nonempty(args)) ?
+			  ((char *) getdata(lastnode(args))) : "");
+
 	    if (!args)
 		args = newlinklist();
 	    shf->node.nam = "(anon)";