1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Fixes #2258 -- allow parameter lists in the vertical style.

This commit is contained in:
Jeremy Ashkenas 2012-04-24 16:56:39 -04:00
parent 8bc6001d27
commit 87257ea6b3
4 changed files with 173 additions and 150 deletions

View file

@ -127,6 +127,10 @@
return [$1];
}), o('ParamList , Param', function() {
return $1.concat($3);
}), o('ParamList OptComma TERMINATOR Param', function() {
return $1.concat($4);
}), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() {
return $1.concat($4);
})
],
Param: [

File diff suppressed because one or more lines are too long

View file

@ -193,6 +193,8 @@ grammar =
o '', -> []
o 'Param', -> [$1]
o 'ParamList , Param', -> $1.concat $3
o 'ParamList OptComma TERMINATOR Param', -> $1.concat $4
o 'ParamList OptComma INDENT ParamList OptComma OUTDENT', -> $1.concat $4
]
# A single parameter in a function definition can be ordinary, or a splat

View file

@ -193,3 +193,16 @@ test "#1844: bound functions in nested comprehensions causing empty var statemen
test "#1859: inline function bodies shouldn't modify prior postfix ifs", ->
list = [1, 2, 3]
ok true if list.some (x) -> x is 2
test "#2258: allow whitespace-style parameter lists in function definitions", ->
func = (
a, b, c
) -> c
eq func(1, 2, 3), 3
func = (
a
b
c
) -> b
eq func(1, 2, 3), 2