mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-22 16:20:23 +02:00
29492: add argument handling to anonymous functions
This commit is contained in:
parent
437d5d98f6
commit
6062529d3f
6 changed files with 133 additions and 40 deletions
|
@ -26,7 +26,7 @@
|
|||
print regress expansion of function names
|
||||
}
|
||||
f$$
|
||||
0:Regression test: `function f$$ () { ... }'
|
||||
0:Regression test: 'function f$$ () { ... }'
|
||||
>regress expansion of function names
|
||||
|
||||
function foo () print bar
|
||||
|
@ -109,6 +109,8 @@
|
|||
>really useful
|
||||
>args
|
||||
|
||||
# ' deconfuse emacs
|
||||
|
||||
command_not_found_handler() {
|
||||
print "Your command:" >&2
|
||||
print "$1" >&2
|
||||
|
@ -201,6 +203,31 @@
|
|||
>Da de da
|
||||
>Do be do
|
||||
|
||||
() { print This has arguments $*; } of all sorts; print After the function
|
||||
function { print More stuff $*; } and why not; print Yet more
|
||||
0:Anonymous function with arguments
|
||||
>This has arguments of all sorts
|
||||
>After the function
|
||||
>More stuff and why not
|
||||
>Yet more
|
||||
|
||||
fn() {
|
||||
(){ print Anonymous function 1 $*; } with args
|
||||
function { print Anonymous function 2 $*; } with more args
|
||||
print Following bit
|
||||
}
|
||||
functions fn
|
||||
0:Text representation of anonymous function with arguments
|
||||
>fn () {
|
||||
> () {
|
||||
> print Anonymous function 1 $*
|
||||
> } with args
|
||||
> () {
|
||||
> print Anonymous function 2 $*
|
||||
> } with more args
|
||||
> print Following bit
|
||||
>}
|
||||
|
||||
%clean
|
||||
|
||||
rm -f file.in file.out
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue