Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

if statement + single line ending by an empty function generate wrong coffeescript #162

Closed
gissehel opened this issue Oct 21, 2012 · 2 comments

Comments

@gissehel
Copy link

if (mystruct) {
    mystruct.onAction = function() {};
}

generates

mystruct.onAction = ->  if mystruct

which generate a coffescript parse error. It should generates :

if mystruct
    mystruct.onAction = ->  
@timaschew
Copy link
Member

since implicit returns are merged, it should be read as

if (mystruct) {
  mystruct.onAction = function() {return};
}

which would produce a correct translation:

if mystruct
  mystruct.onAction = ->
    return

TODO: check #168

@timaschew
Copy link
Member

need to extend #168 add return also for empty functions

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants