From 1274a185962cd80082ffa753b205f597ff93e9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 29 Mar 2022 18:13:12 -0400 Subject: [PATCH] optimize: don't memoise non-root right when there is only one destructuring in the left --- .../src/index.ts | 33 +++++++++++-------- .../src/util.ts | 13 +++++++- .../array-rest-only/output.js | 4 +-- .../nested-under-array-pattern/output.js | 4 +-- .../under-param-initializer/output.js | 4 +-- .../assignment/array-rest-only/output.js | 4 +-- .../nested-under-array-pattern/output.js | 4 +-- .../under-param-initializer/output.js | 4 +-- .../lhs-with-assign/output.js | 2 +- .../fixtures/for-init--es2015/lhs/output.js | 2 +- .../output.js | 4 +-- .../for-init/lhs-with-assign/output.js | 2 +- .../test/fixtures/for-init/lhs/output.js | 2 +- .../output.js | 4 +-- .../array-rest-only/output.js | 5 ++- .../nested-under-array-pattern/output.js | 8 ++--- .../non-identifier-keys/output.js | 12 +++---- .../array-rest-only/output.js | 5 ++- .../nested-under-array-pattern/output.js | 9 ++--- .../non-identifier-keys/output.js | 12 +++---- 20 files changed, 69 insertions(+), 68 deletions(-) diff --git a/packages/babel-plugin-proposal-destructuring-private/src/index.ts b/packages/babel-plugin-proposal-destructuring-private/src/index.ts index 7b8108c0528a..ec6d1d4819c6 100644 --- a/packages/babel-plugin-proposal-destructuring-private/src/index.ts +++ b/packages/babel-plugin-proposal-destructuring-private/src/index.ts @@ -125,6 +125,7 @@ export default declare(function ({ declarator.init, scope, /* isAssignment */ false, + /* shouldPreserveCompletion */ false, name => state.addHelper(name), objectRestNoSymbols, /* useBuiltIns */ true, @@ -140,12 +141,16 @@ export default declare(function ({ const { node, scope, parent } = path; if (!hasPrivateKeys(node.left)) return; const assignments = []; + const shouldPreserveCompletion = + (!isExpressionStatement(parent) && !isSequenceExpression(parent)) || + path.isCompletionRecord(); for (const { left, right } of transformPrivateKeyDestructuring( // @ts-expect-error The left of an assignment expression must not be a RestElement node.left, node.right, scope, /* isAssignment */ true, + shouldPreserveCompletion, name => state.addHelper(name), objectRestNoSymbols, /* useBuiltIns */ true, @@ -153,25 +158,25 @@ export default declare(function ({ assignments.push(assignmentExpression("=", left, right)); } // preserve completion record - if ( - (!isExpressionStatement(parent) && !isSequenceExpression(parent)) || - path.isCompletionRecord() - ) { - const { left } = assignments[0]; - if (scope.isStatic(node.right)) { + if (shouldPreserveCompletion) { + const { left, right } = assignments[0]; + // If node.right is right and left is an identifier, then the left is an effectively-constant memoised id + if (isIdentifier(left) && right === node.right) { + if ( + !isIdentifier(assignments[assignments.length - 1].right, { + name: left.name, + }) + ) { + // If the last assignment does not end with left, then we push `left` as the completion value + assignments.push(cloneNode(left)); + } + // do nothing as `left` is already at the end of assignments + } else { const tempId = scope.generateDeclaredUidIdentifier("m"); assignments.unshift( assignmentExpression("=", tempId, cloneNode(node.right)), ); assignments.push(cloneNode(tempId)); - } else if ( - !isIdentifier(assignments[assignments.length - 1].right, { - name: left.name, - }) - ) { - // If node.right is non-static and then the left is an effectively-constant memoised id - // If the last assignment does not end with left, that we can safely reuse `left` as the completion value - assignments.push(cloneNode(left)); } } diff --git a/packages/babel-plugin-proposal-destructuring-private/src/util.ts b/packages/babel-plugin-proposal-destructuring-private/src/util.ts index f3fcb2ad0627..e7b13fafe105 100644 --- a/packages/babel-plugin-proposal-destructuring-private/src/util.ts +++ b/packages/babel-plugin-proposal-destructuring-private/src/util.ts @@ -281,6 +281,8 @@ function rightWillBeReferencedOnce(left: LHS) { case "Identifier": case "ArrayPattern": return true; + case "ObjectPattern": + return left.properties.length === 1; default: return false; } @@ -302,11 +304,13 @@ export function* transformPrivateKeyDestructuring( right: t.Expression, scope: Scope, isAssignment: boolean, + shouldPreserveCompletion: boolean, addHelper: File["addHelper"], objectRestNoSymbols: boolean, useBuiltIns: boolean, ): Generator { const stack: Item[] = []; + const rootRight = right; // The stack holds patterns that we don't known whether they contain private key stack.push({ left, @@ -353,7 +357,14 @@ export function* transformPrivateKeyDestructuring( (index = indexPath.shift()) !== undefined || left.type === "AssignmentPattern" ) { - if (!rightWillBeReferencedOnce(left) && !scope.isStatic(right)) { + const isRightSafeToReuse = + // If we should preserve completion and the right is the rootRight, then the + // right is NOT safe to reuse because we will insert a new memoising statement + // in the AssignmentExpression visitor, which causes right to be referenced more + // than once + !(shouldPreserveCompletion && right === rootRight) && + (rightWillBeReferencedOnce(left) || scope.isStatic(right)); + if (!isRightSafeToReuse) { const tempId = scope.generateUidIdentifier("m"); if (isAssignment) { scope.push({ id: cloneNode(tempId) }); diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/array-rest-only/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/array-rest-only/output.js index 59b36bdb85bf..2691e38a1b03 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/array-rest-only/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/array-rest-only/output.js @@ -9,10 +9,10 @@ var _x = { }; (() => { - var _p, _m, _m2; + var _p, _m; var x, z; - [..._p] = [C], _m = _p[0], _m2 = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), x = _m2 === void 0 ? 1 : _m2, z = babelHelpers.objectWithoutProperties(_p, _excluded); + [..._p] = [C], _m = babelHelpers.classStaticPrivateFieldSpecGet(_p[0], C, _x), x = _m === void 0 ? 1 : _m, z = babelHelpers.objectWithoutProperties(_p, _excluded); result = { x, z diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/nested-under-array-pattern/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/nested-under-array-pattern/output.js index 33b5a2e4846c..3454fb0bf7dd 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/nested-under-array-pattern/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/nested-under-array-pattern/output.js @@ -19,8 +19,8 @@ var _z = { babelHelpers.defineProperty(C, "self", C); (() => { - var _p, _p2, _p3, _m, _p4, _m2, _m3; + var _p, _p2, _p3, _p4, _m; let x, y, z; - [_p, _p2,, _p3] = [C, C], _m = _p === void 0 ? C.self : _p, x = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), [, _p4] = babelHelpers.classStaticPrivateFieldSpecGet(_p2, C, _y), _m2 = _p4 === void 0 ? C.self : _p4, _m3 = babelHelpers.classStaticPrivateFieldSpecGet(_m2, C, _z), y = _m3 === void 0 ? babelHelpers.classStaticPrivateMethodGet(C, C, _self).call(C) : _m3, z = _p3 === void 0 ? babelHelpers.classStaticPrivateFieldSpecGet(y, C, _y) : _p3; + [_p, _p2,, _p3] = [C, C], x = babelHelpers.classStaticPrivateFieldSpecGet(_p === void 0 ? C.self : _p, C, _x), [, _p4] = babelHelpers.classStaticPrivateFieldSpecGet(_p2, C, _y), _m = babelHelpers.classStaticPrivateFieldSpecGet(_p4 === void 0 ? C.self : _p4, C, _z), y = _m === void 0 ? babelHelpers.classStaticPrivateMethodGet(C, C, _self).call(C) : _m, z = _p3 === void 0 ? babelHelpers.classStaticPrivateFieldSpecGet(y, C, _y) : _p3; })(); diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/under-param-initializer/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/under-param-initializer/output.js index 829bd11aa63a..d0f627623477 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/under-param-initializer/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment--es2015/under-param-initializer/output.js @@ -5,7 +5,7 @@ let a; class C { static m(r = (_m2 = C, ({ a - } = babelHelpers.classStaticPrivateFieldSpecGet(C, C, _x)), _m2)) {} + } = babelHelpers.classStaticPrivateFieldSpecGet(_m2, C, _x)), _m2)) {} } @@ -24,7 +24,7 @@ var _x = { (function f(r = (_m = C, ({ b - } = babelHelpers.classStaticPrivateFieldSpecGet(C, C, _x)), _m)) {})(); + } = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x)), _m)) {})(); })(); C.m(); diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/array-rest-only/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/array-rest-only/output.js index 2c48b1a27473..9eae325d1e7e 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/array-rest-only/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/array-rest-only/output.js @@ -4,10 +4,10 @@ let result; class C { static #x; static { - var _p, _m, _m2; + var _p, _m; var x, z; - [..._p] = [C], _m = _p[0], _m2 = _m.#x, x = _m2 === void 0 ? 1 : _m2, z = babelHelpers.objectWithoutProperties(_p, _excluded); + [..._p] = [C], _m = _p[0].#x, x = _m === void 0 ? 1 : _m, z = babelHelpers.objectWithoutProperties(_p, _excluded); result = { x, z diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/nested-under-array-pattern/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/nested-under-array-pattern/output.js index f9c62bbeb4f6..3d9e614af2a0 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/nested-under-array-pattern/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/nested-under-array-pattern/output.js @@ -9,9 +9,9 @@ class C { } static { - var _p, _p2, _p3, _m, _p4, _m2, _m3; + var _p, _p2, _p3, _p4, _m; let x, y, z; - [_p, _p2,, _p3] = [this, this], _m = _p === void 0 ? C.self : _p, x = _m.#x, [, _p4] = _p2.#y, _m2 = _p4 === void 0 ? C.self : _p4, _m3 = _m2.#z, y = _m3 === void 0 ? C.#self() : _m3, z = _p3 === void 0 ? y.#y : _p3; + [_p, _p2,, _p3] = [this, this], x = (_p === void 0 ? C.self : _p).#x, [, _p4] = _p2.#y, _m = (_p4 === void 0 ? C.self : _p4).#z, y = _m === void 0 ? C.#self() : _m, z = _p3 === void 0 ? y.#y : _p3; } } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/under-param-initializer/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/under-param-initializer/output.js index 21c71cdb74c7..e666e783149e 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/under-param-initializer/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/assignment/under-param-initializer/output.js @@ -14,13 +14,13 @@ class C { (function f(r = (_m = C, ({ b - } = C.#x), _m)) {})(); + } = _m.#x), _m)) {})(); } static m(r = (_m2 = C, ({ a - } = C.#x), _m2)) {} + } = _m2.#x), _m2)) {} } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs-with-assign/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs-with-assign/output.js index a1dbc5da395e..ba1bd3c17a15 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs-with-assign/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs-with-assign/output.js @@ -8,7 +8,7 @@ var _x = { (() => { let x, y; - for (_m = (_m2 = C, y = babelHelpers.classStaticPrivateFieldSpecGet(C, C, _x), _m2), x = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), _m;;) { + for (_m = (_m2 = C, y = babelHelpers.classStaticPrivateFieldSpecGet(_m2, C, _x), _m2), x = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), _m;;) { var _m, _m2; break; diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs/output.js index 48d4b0febd9b..12bf9e55f321 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/lhs/output.js @@ -11,7 +11,7 @@ class C { } (() => { - for (_m = C, x = babelHelpers.classPrivateFieldGet(C, _x), _m;;) { + for (_m = C, x = babelHelpers.classPrivateFieldGet(_m, _x), _m;;) { var _m; break; diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/variable-declaration-with-assign/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/variable-declaration-with-assign/output.js index bef362866c61..89c4773d5c46 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/variable-declaration-with-assign/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init--es2015/variable-declaration-with-assign/output.js @@ -8,8 +8,8 @@ var _x = { (() => { let y; - for (let _m = (_m2 = C, y = babelHelpers.classStaticPrivateFieldSpecGet(C, C, _x), _m2), x = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x);;) { - var _m2; + for (let x = babelHelpers.classStaticPrivateFieldSpecGet((_m = C, y = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), _m), C, _x);;) { + var _m; break; } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs-with-assign/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs-with-assign/output.js index e52600816752..fb12bc77834a 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs-with-assign/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs-with-assign/output.js @@ -3,7 +3,7 @@ class C { static { let x, y; - for (_m = (_m2 = C, y = C.#x, _m2), x = _m.#x, _m;;) { + for (_m = (_m2 = C, y = _m2.#x, _m2), x = _m.#x, _m;;) { var _m, _m2; break; diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs/output.js index e4f394a6488b..9ef3ef20cb47 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/lhs/output.js @@ -1,7 +1,7 @@ class C { #x; static { - for (_m = this, x = this.#x, _m;;) { + for (_m = this, x = _m.#x, _m;;) { var _m; break; diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/variable-declaration-with-assign/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/variable-declaration-with-assign/output.js index 29bb33212367..df0a155d4efa 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/variable-declaration-with-assign/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/for-init/variable-declaration-with-assign/output.js @@ -3,8 +3,8 @@ class C { static { let y; - for (let _m = (_m2 = C, y = C.#x, _m2), x = _m.#x;;) { - var _m2; + for (let x = (_m = C, y = _m.#x, _m).#x;;) { + var _m; break; } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/array-rest-only/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/array-rest-only/output.js index 950a15a5a50f..34b1fbe5524c 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/array-rest-only/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/array-rest-only/output.js @@ -10,9 +10,8 @@ var _x = { (() => { var [..._p] = [C], - _m = _p[0], - _m2 = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), - x = _m2 === void 0 ? 1 : _m2, + _m = babelHelpers.classStaticPrivateFieldSpecGet(_p[0], C, _x), + x = _m === void 0 ? 1 : _m, z = babelHelpers.objectWithoutProperties(_p, _excluded); result = { diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/nested-under-array-pattern/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/nested-under-array-pattern/output.js index b8a83d383ded..6d62674ff6ca 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/nested-under-array-pattern/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/nested-under-array-pattern/output.js @@ -20,11 +20,9 @@ babelHelpers.defineProperty(C, "self", C); (() => { var [_p, _p2,, _p3] = [C, C], - _m = _p === void 0 ? C.self : _p, - x = babelHelpers.classStaticPrivateFieldSpecGet(_m, C, _x), + x = babelHelpers.classStaticPrivateFieldSpecGet(_p === void 0 ? C.self : _p, C, _x), [, _p4] = babelHelpers.classStaticPrivateFieldSpecGet(_p2, C, _y), - _m2 = _p4 === void 0 ? C.self : _p4, - _m3 = babelHelpers.classStaticPrivateFieldSpecGet(_m2, C, _z), - y = _m3 === void 0 ? babelHelpers.classStaticPrivateMethodGet(C, C, _self).call(C) : _m3, + _m = babelHelpers.classStaticPrivateFieldSpecGet(_p4 === void 0 ? C.self : _p4, C, _z), + y = _m === void 0 ? babelHelpers.classStaticPrivateMethodGet(C, C, _self).call(C) : _m, z = _p3 === void 0 ? babelHelpers.classStaticPrivateFieldSpecGet(y, C, _y) : _p3; })(); diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/non-identifier-keys/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/non-identifier-keys/output.js index 5c6376193ae1..0579a8964deb 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/non-identifier-keys/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration--es2015/non-identifier-keys/output.js @@ -2,13 +2,9 @@ class C { static #x; static { var _m = [C, C, C, C], - _m2 = _m["0"], - w = _m2.#x, - _m3 = _m[1], - x = _m3.#x, - _m4 = _m[2n], - y = _m4.#x, - _m5 = _m[3m], - z = _m5.#x; + w = _m["0"].#x, + x = _m[1].#x, + y = _m[2n].#x, + z = _m[3m].#x; } } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/array-rest-only/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/array-rest-only/output.js index 4f9d2a55f976..7930e97e528f 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/array-rest-only/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/array-rest-only/output.js @@ -5,9 +5,8 @@ class C { static #x; static { var [..._p] = [C], - _m = _p[0], - _m2 = _m.#x, - x = _m2 === void 0 ? 1 : _m2, + _m = _p[0].#x, + x = _m === void 0 ? 1 : _m, z = babelHelpers.objectWithoutProperties(_p, _excluded); result = { x, diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/nested-under-array-pattern/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/nested-under-array-pattern/output.js index f9fbd0b90bc0..634cc2709bd9 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/nested-under-array-pattern/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/nested-under-array-pattern/output.js @@ -10,13 +10,10 @@ class C { static { var [_p, _p2,, _p3] = [this, this], - _m = _p === void 0 ? C.self : _p, - x = _m.#x, + x = (_p === void 0 ? C.self : _p).#x, [, _p4] = _p2.#y, - _m2 = _p4 === void 0 ? C.self : _p4, - _m3 = _m2.#z, - y = _m3 === void 0 ? C.#self() : _m3, + _m = (_p4 === void 0 ? C.self : _p4).#z, + y = _m === void 0 ? C.#self() : _m, z = _p3 === void 0 ? y.#y : _p3; - } } diff --git a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/non-identifier-keys/output.js b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/non-identifier-keys/output.js index 5c6376193ae1..0579a8964deb 100644 --- a/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/non-identifier-keys/output.js +++ b/packages/babel-plugin-proposal-destructuring-private/test/fixtures/variable-declaration/non-identifier-keys/output.js @@ -2,13 +2,9 @@ class C { static #x; static { var _m = [C, C, C, C], - _m2 = _m["0"], - w = _m2.#x, - _m3 = _m[1], - x = _m3.#x, - _m4 = _m[2n], - y = _m4.#x, - _m5 = _m[3m], - z = _m5.#x; + w = _m["0"].#x, + x = _m[1].#x, + y = _m[2n].#x, + z = _m[3m].#x; } }