fix:added check for forXstatement pattern (#11703)
This commit is contained in:
parent
3704728637
commit
183acbae25
@ -329,6 +329,8 @@ const handle = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for (MEMBER of ARR)
|
||||||
|
// for (MEMBER in ARR)
|
||||||
// { KEY: MEMBER } = OBJ -> { KEY: _destructureSet(MEMBER) } = OBJ
|
// { KEY: MEMBER } = OBJ -> { KEY: _destructureSet(MEMBER) } = OBJ
|
||||||
// { KEY: MEMBER = _VALUE } = OBJ -> { KEY: _destructureSet(MEMBER) = _VALUE } = OBJ
|
// { KEY: MEMBER = _VALUE } = OBJ -> { KEY: _destructureSet(MEMBER) = _VALUE } = OBJ
|
||||||
// {...MEMBER} -> {..._destructureSet(MEMBER)}
|
// {...MEMBER} -> {..._destructureSet(MEMBER)}
|
||||||
@ -337,6 +339,9 @@ const handle = {
|
|||||||
// [MEMBER = _VALUE] = ARR -> [_destructureSet(MEMBER) = _VALUE] = ARR
|
// [MEMBER = _VALUE] = ARR -> [_destructureSet(MEMBER) = _VALUE] = ARR
|
||||||
// [...MEMBER] -> [..._destructureSet(MEMBER)]
|
// [...MEMBER] -> [..._destructureSet(MEMBER)]
|
||||||
if (
|
if (
|
||||||
|
// for (MEMBER of ARR)
|
||||||
|
// for (MEMBER in ARR)
|
||||||
|
parentPath.isForXStatement({ left: node }) ||
|
||||||
// { KEY: MEMBER } = OBJ
|
// { KEY: MEMBER } = OBJ
|
||||||
(parentPath.isObjectProperty({ value: node }) &&
|
(parentPath.isObjectProperty({ value: node }) &&
|
||||||
parentPath.parentPath.isObjectPattern()) ||
|
parentPath.parentPath.isObjectPattern()) ||
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
class D {
|
||||||
|
#arr;
|
||||||
|
f() {
|
||||||
|
for (const el of this.#arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
#p;
|
||||||
|
m() {
|
||||||
|
for (this.#p of []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class E {
|
||||||
|
#arr;
|
||||||
|
f() {
|
||||||
|
for (this.#arr of [1, 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class F {
|
||||||
|
#ar;
|
||||||
|
g() {
|
||||||
|
for (this.#ar in [1,2,3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
var _arr = new WeakMap();
|
||||||
|
|
||||||
|
var D = /*#__PURE__*/function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function D() {
|
||||||
|
babelHelpers.classCallCheck(this, D);
|
||||||
|
|
||||||
|
_arr.set(this, {
|
||||||
|
writable: true,
|
||||||
|
value: void 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
babelHelpers.createClass(D, [{
|
||||||
|
key: "f",
|
||||||
|
value: function f() {
|
||||||
|
for (var el of babelHelpers.classPrivateFieldGet(this, _arr)) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return D;
|
||||||
|
}();
|
||||||
|
|
||||||
|
var _p = new WeakMap();
|
||||||
|
|
||||||
|
var C = /*#__PURE__*/function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function C() {
|
||||||
|
babelHelpers.classCallCheck(this, C);
|
||||||
|
|
||||||
|
_p.set(this, {
|
||||||
|
writable: true,
|
||||||
|
value: void 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
babelHelpers.createClass(C, [{
|
||||||
|
key: "m",
|
||||||
|
value: function m() {
|
||||||
|
for (babelHelpers.classPrivateFieldDestructureSet(this, _p).value of []) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return C;
|
||||||
|
}();
|
||||||
|
|
||||||
|
var _arr2 = new WeakMap();
|
||||||
|
|
||||||
|
var E = /*#__PURE__*/function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function E() {
|
||||||
|
babelHelpers.classCallCheck(this, E);
|
||||||
|
|
||||||
|
_arr2.set(this, {
|
||||||
|
writable: true,
|
||||||
|
value: void 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
babelHelpers.createClass(E, [{
|
||||||
|
key: "f",
|
||||||
|
value: function f() {
|
||||||
|
for (babelHelpers.classPrivateFieldDestructureSet(this, _arr2).value of [1, 2]) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return E;
|
||||||
|
}();
|
||||||
|
|
||||||
|
var _ar = new WeakMap();
|
||||||
|
|
||||||
|
var F = /*#__PURE__*/function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function F() {
|
||||||
|
babelHelpers.classCallCheck(this, F);
|
||||||
|
|
||||||
|
_ar.set(this, {
|
||||||
|
writable: true,
|
||||||
|
value: void 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
babelHelpers.createClass(F, [{
|
||||||
|
key: "g",
|
||||||
|
value: function g() {
|
||||||
|
for (babelHelpers.classPrivateFieldDestructureSet(this, _ar).value in [1, 2, 3]) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return F;
|
||||||
|
}();
|
||||||
Loading…
x
Reference in New Issue
Block a user