You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: don't shrink loop bounds by assuming the body is at the end (#74)
Fixesdecaffeinate/decaffeinate#333Fixesdecaffeinate/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.
0 commit comments