bublejs / buble

https://buble.surge.sh
MIT License
871 stars 67 forks source link

Prevent labels from being renamed due to let/const transpilation. #236

Closed luiscubal closed 4 years ago

luiscubal commented 4 years ago

When a label has the same name as a variable that has been renamed due to let/const transpilation, the label may also be renamed. This should not happen, since labels do not follow the same scope rules as variables. This commit prevents labeled continues and label statements from being renamed, fixing the issue. Labeled break were not buggy, as breaks do not initialise their children anyway, but this commit also adds breaks to the list of renames to skip, for consistency.

See the added tests for examples that were previously buggy.

luiscubal commented 4 years ago

No clue why the tests for Node 6 are failing.