destructuring private fields with array pattern / object patte… (#10017)
* destructuring private fields with array pattern / object pattern * wip: new test cases * destrucuring and rest for private properties * test case for loose private-loose * add transform-desturcturing for exec * update test case * remove getPrototypeOf imports from get and set * wip: destructure super assignment * throw "Destructuring to a super field is not supported yet." * fix tests and fix assignment pattern * remove CallExpression from AssignmentPattern
This commit is contained in:
committed by
Nicolò Ribaudo
parent
7f47cb65d0
commit
d3fe22f0e1
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
foo(props) {
|
||||
;([x, ...super.client] = props);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.foo = function foo(props) {
|
||||
;
|
||||
[x, ...this.client] = props;
|
||||
};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
foo(props) {
|
||||
;([super.client] = props);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.foo = function foo(props) {
|
||||
;
|
||||
[this.client] = props;
|
||||
};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
foo(props) {
|
||||
;({ x, ...super.client } = props)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.foo = function foo(props) {
|
||||
;
|
||||
({
|
||||
x,
|
||||
...this.client
|
||||
} = props);
|
||||
};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
foo(props) {
|
||||
;({ client: super.client } = props)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto.foo = function foo(props) {
|
||||
;
|
||||
({
|
||||
client: this.client
|
||||
} = props);
|
||||
};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
constructor(props) {
|
||||
;([x, ...super.client] = props);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-function-name",
|
||||
"transform-classes",
|
||||
"transform-spread",
|
||||
"transform-block-scoping"
|
||||
],
|
||||
"throws": "Destructuring to a super field is not supported yet."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
constructor(props) {
|
||||
;([super.client] = props);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-function-name",
|
||||
"transform-classes",
|
||||
"transform-spread",
|
||||
"transform-block-scoping"
|
||||
],
|
||||
"throws": "Destructuring to a super field is not supported yet."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
constructor(props) {
|
||||
;({ x, ...super.client } = props)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-function-name",
|
||||
"transform-classes",
|
||||
"transform-spread",
|
||||
"transform-block-scoping"
|
||||
],
|
||||
"throws": "Destructuring to a super field is not supported yet."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
constructor(props) {
|
||||
;({ client: super.client } = props)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-function-name",
|
||||
"transform-classes",
|
||||
"transform-spread",
|
||||
"transform-block-scoping"
|
||||
],
|
||||
"throws": "Destructuring to a super field is not supported yet."
|
||||
}
|
||||
Reference in New Issue
Block a user