bublejs / buble

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

fix: make letConst transpilation add explicit keys when appropriate #228

Closed luiscubal closed 5 years ago

luiscubal commented 5 years ago

When letConst transpilation is on, buble renames some variables, such as x->x$1. However, when shorthand properties are used, this causes the property key to change. The appropriate fix is to make those properties no longer be shorthand, so something like { x : x$1 } is used. This applies both to object literals and object destructuring patterns.

The destructuring and concise property transpilation options hide this bug, so this commit only improves the situation for use-cases where letConst transpilation is used without those options.