diff --git a/packages/babel-plugin-transform-destructuring/src/index.js b/packages/babel-plugin-transform-destructuring/src/index.js index 714e5f5afb..cc60ebd458 100644 --- a/packages/babel-plugin-transform-destructuring/src/index.js +++ b/packages/babel-plugin-transform-destructuring/src/index.js @@ -166,7 +166,7 @@ export default declare((api, options) => { let patternId; let node; - if (this.kind === "const") { + if (this.kind === "const" || this.kind === "let") { patternId = this.scope.generateUidIdentifier(tempId.name); node = this.buildVariableDeclaration(patternId, tempConditional); } else { diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js new file mode 100644 index 0000000000..4c54b1e75d --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/input.js @@ -0,0 +1,2 @@ +for (let [[x] = [1]] = []; ; ) { +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js new file mode 100644 index 0000000000..9c0f8685ef --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/for-let-nest/output.js @@ -0,0 +1 @@ +for (var _ref = [], _ref$ = _ref[0], _ref$2 = _ref$ === void 0 ? [1] : _ref$, _ref$3 = babelHelpers.slicedToArray(_ref$2, 1), x = _ref$3[0];;) {} \ No newline at end of file