Skip to content
New issue

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

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

Already on GitHub? Sign in 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

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

No branches or pull requests

3 participants