Class static private field destructure set (#12917)
* fix: support static private field destructure set ([C.#p] = [0]) * 🚧 * fix: add compatibility warning for older @babel/helper versions * refactor: extract common routines among classPrivateFiled helpers * More 🚧
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
static #method() {}
|
||||
|
||||
run() {
|
||||
expect(() => A.#method = 2).toThrow(TypeError);
|
||||
expect(() => ([A.#method] = [2])).toThrow(TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
static #method() {}
|
||||
|
||||
run() {
|
||||
A.#method = 2;
|
||||
([A.#method] = [2]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
run() {
|
||||
babelHelpers.classStaticPrivateMethodSet(A, A, _method, 2);
|
||||
[babelHelpers.classStaticPrivateFieldDestructureSet(A, A, _method).value] = [2];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var _method = function _method() {};
|
||||
Reference in New Issue
Block a user