incorrect destructuring of assignment expression for console.log([x, y] = [1, 2])
expected:
$ echo 'var x, y; console.log([x, y] = [1, 2])' | node
[ 1, 2 ]Bublé version 0.14.2 transpile:
$ echo 'var x, y; console.log([x, y] = [1, 2])' | bin/buble
var x, y; var assign;
console.log((assign = [1, 2], x = assign[0], y = assign[1]))actual (incorrect) result:
$ echo 'var x, y; console.log([x, y] = [1, 2])' | bin/buble | node
2This buble test result is incorrect:
{
description: 'lifts its variable declarations out of the expression',
input: `
foo();
if ( bar([x, y] = [1, 2]) ) {
baz();
}`,
output: `
foo();
var assign;
if ( bar((assign = [1, 2], x = assign[0], y = assign[1])) ) {
baz();
}`
},Specifically this line:
if ( bar((assign = [1, 2], x = assign[0], y = assign[1])) ) {It should be:
if ( bar((assign = [1, 2], x = assign[0], y = assign[1], assign)) ) {
^^^^^^^^