Skip to content

simplify destructuring assignment statements

buble@0.15.1 emits the following for destructuring assignment statements:

$ echo '[x]=[1,2];' | buble
var assign;
(assign = [1,2], x = assign[0], assign);

With this patch it will not emit the unnecessary trailing ", assign":

$ echo '[x]=[1,2];' | bin/buble 
var assign;
(assign = [1,2], x = assign[0]);

Note: this patch will not alter the behavior of destructuring assignment expressions:

$ echo 'console.log([x]=[1,2]);' | bin/buble 
var assign;
console.log((assign = [1,2], x = assign[0], assign));

Notice the rvalue ", assign" is still emitted in this case.

Merge request reports