-
Notifications
You must be signed in to change notification settings - Fork 120
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
wrapping when
clause in paren causes error
#502
Closed
Comments
when
clause in paren cause errorwhen
clause in paren causes error
alangpierce
added a commit
to alangpierce/decaffeinate-parser
that referenced
this issue
Nov 13, 2016
Fixes decaffeinate/decaffeinate#333 Fixes decaffeinate/decaffeinate#502 The code to fix CoffeeScript location data was incorrectly assuming that the last node of a loop is the loop body, but that isn't true in postfix loops, so it was causing the end location to be artificially early. Probably, the ideal behavior (assuming location data actually needs to be fixed here) is to take the max of all nodes, but that didn't seem trivial. Instead, an easy fix is to just do the same thing we do for the `if` case: just use the body to extend the bounds if necessary, but never shrink it. This also seems more robust in general, probably. At the very least, it's really simple and doesn't break any decaffeinate tests.
alangpierce
added a commit
to decaffeinate/decaffeinate-parser
that referenced
this issue
Nov 13, 2016
Fixes decaffeinate/decaffeinate#333 Fixes decaffeinate/decaffeinate#502 The code to fix CoffeeScript location data was incorrectly assuming that the last node of a loop is the loop body, but that isn't true in postfix loops, so it was causing the end location to be artificially early. Probably, the ideal behavior (assuming location data actually needs to be fixed here) is to take the max of all nodes, but that didn't seem trivial. Instead, an easy fix is to just do the same thing we do for the `if` case: just use the body to extend the bounds if necessary, but never shrink it. This also seems more robust in general, probably. At the very least, it's really simple and doesn't break any decaffeinate tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
decaffeinate is crashing on my CoffeeScript input:
http://decaffeinate-project.org/repl/#?evaluate=true&stage=full&code=x%20for%20a%20in%20%5B1%2C2%2C3%5D%20when%20(x%20%3D%3D%201)
I get this error:
The text was updated successfully, but these errors were encountered: