mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
Added the ability for function declaration to have a splat at an arbitrary position, not just at the end. Still restrict their number to 1. Adjusted tests accordingly.
This commit is contained in:
@@ -6,13 +6,14 @@ result: func 1, 2, 3, 4, 5
|
||||
ok result is "3 4 5"
|
||||
|
||||
|
||||
gold: silver: bronze: the_field: null
|
||||
gold: silver: bronze: the_field: last: null
|
||||
|
||||
medalists: (first, second, third, rest...) ->
|
||||
medalists: (first, second, third, rest..., unlucky) ->
|
||||
gold: first
|
||||
silver: second
|
||||
bronze: third
|
||||
the_field: rest
|
||||
the_field: rest.concat([last])
|
||||
last: unlucky
|
||||
|
||||
contenders: [
|
||||
"Michael Phelps"
|
||||
@@ -32,6 +33,7 @@ medalists "Mighty Mouse", contenders...
|
||||
ok gold is "Mighty Mouse"
|
||||
ok silver is "Michael Phelps"
|
||||
ok bronze is "Liu Xiang"
|
||||
ok last is "Usain Bolt"
|
||||
ok the_field.length is 8
|
||||
|
||||
contenders.reverse()
|
||||
@@ -40,6 +42,7 @@ medalists contenders[0...2]..., "Mighty Mouse", contenders[2...contenders.length
|
||||
ok gold is "Usain Bolt"
|
||||
ok silver is "Asafa Powell"
|
||||
ok bronze is "Mighty Mouse"
|
||||
ok last is "Michael Phelps"
|
||||
ok the_field.length is 8
|
||||
|
||||
obj: {
|
||||
|
||||
Reference in New Issue
Block a user