jashkenas/coffee-script — Issue #2064: Syntax error when passing anonymous function as parameter
Author: AdleyEskridge
Created: 2012-01-23 03:11:44+00:00
State: open

In an object declaration, passing an anonymous function to a function _without the optional parentheses for the function call_ results in a syntax error if is at least one other parameter being passed to the function. If the anonymous function is wrapped in parentheses, the syntax error goes away _only if the anonymous function is the first parameter_.

I feel the best way to demonstrate this possible bug is with the following code:

```coffeescript
fun = ->

noError = prop: fun ->
noError = prop: fun (->), 'dummy'
syntaxError = prop: fun ->, 'dummy'
syntaxError = prop: fun 'dummy', ->
syntaxError = prop: fun 'dummy', (->)
noError = prop: fun('dummy', ->)
```