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 a then if b then c else d #3169

Closed
michaelficarra opened this issue Sep 16, 2013 · 2 comments
Closed

if a then if b then c else d #3169

michaelficarra opened this issue Sep 16, 2013 · 2 comments
Labels

Comments

@michaelficarra
Copy link
Collaborator

The correct JS associativity: http://esprima.org/demo/parse.html?code=if(a)%20if(b)%20c%3B%20else%20d

This compiler associates to the outer if.

$ coffee -bep 'if a then if b then c else d'
if (a) {
  if (b) {
    c;
  }
} else {
  d;
}

My compiler handles this correctly, associating with the inner if.

coffee --js --no-optimise --cli 'if a then if b then c else d'
// Generated by CoffeeScript 2.0.0-beta8-dev
if (a)
  if (b) {
    c;
  } else {
    d;
  }

Also, if a then if b then c else d else e fails to parse.

@vendethiel
Copy link
Collaborator

Isn't that just good ol' satyr/coco#127 (/ #2342) ?

@michaelficarra
Copy link
Collaborator Author

Oh, damn. I knew there was an issue. Closing in favour of #2342.

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

No branches or pull requests

2 participants