fix Incorrect destructuring compilation of `for (let [[x] = [1… (#11360)

This commit is contained in:
Zen 2020-04-07 23:10:21 +08:00 committed by GitHub
parent e3ad798a24
commit ca096c56aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -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 {

View File

@ -0,0 +1,2 @@
for (let [[x] = [1]] = []; ; ) {
}

View File

@ -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];;) {}