fix export when array destructuring exported value with hole

This commit is contained in:
Henry Zhu
2017-08-04 11:53:49 -04:00
parent 8c457e9283
commit 577173cc02
3 changed files with 13 additions and 0 deletions

View File

@@ -119,6 +119,8 @@ export default function() {
}
} else if (left.isArrayPattern()) {
for (const element of left.node.elements) {
if (!element) continue;
const name = element.name;
const exports = this.exports[name];

View File

@@ -12,3 +12,7 @@ export function f2 () {
export function f3 () {
[x, y, z] = [3, 4, 5]
}
export function f4 () {
[x, , y] = [3, 4, 5]
}

View File

@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
exports.f1 = f1;
exports.f2 = f2;
exports.f3 = f3;
exports.f4 = f4;
let x = exports.x = 0;
let y = exports.y = 0;
@@ -35,3 +36,9 @@ function f3() {
exports.y = y;
exports.x = x;
}
function f4() {
[x,, y] = [3, 4, 5];
exports.y = y;
exports.x = x;
}