Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
destrucuring and rest for private properties
- Loading branch information
Showing
13 changed files
with
106 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 12 additions & 24 deletions
36
...n-proposal-class-properties/test/fixtures/private/destructuring-array-pattern-1/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
var Foo = | ||
/*#__PURE__*/ | ||
function () { | ||
"use strict"; | ||
|
||
function Foo(props) { | ||
var _this$client; | ||
function _classPrivateFieldDestructureSet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } var descriptor = privateMap.get(receiver); if (descriptor.set) { if (!("__destrObj" in descriptor)) { descriptor.__destrObj = { set value(v) { descriptor.set.call(receiver, v); } }; } return descriptor.__destrObj; } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } return descriptor; } } | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
; | ||
[_this$client] = props; | ||
babelHelpers.classPrivateFieldSet(this, _client, _this$client); | ||
} | ||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "getClient", | ||
value: function getClient() { | ||
return babelHelpers.classPrivateFieldGet(this, _client); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
babelHelpers.classPrivateFieldSet(this, _client, 1); | ||
; | ||
[this.x = babelHelpers.classPrivateFieldGet(this, _client), _classPrivateFieldDestructureSet(this, _client).value, this.y = babelHelpers.classPrivateFieldGet(this, _client)] = props; | ||
}; | ||
|
||
var _client = new WeakMap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 11 additions & 24 deletions
35
...n-proposal-class-properties/test/fixtures/private/destructuring-array-pattern-2/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
var Foo = | ||
/*#__PURE__*/ | ||
function () { | ||
"use strict"; | ||
|
||
function Foo(props) { | ||
var _this$client; | ||
function _classPrivateFieldDestructureSet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } var descriptor = privateMap.get(receiver); if (descriptor.set) { if (!("__destrObj" in descriptor)) { descriptor.__destrObj = { set value(v) { descriptor.set.call(receiver, v); } }; } return descriptor.__destrObj; } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } return descriptor; } } | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
; | ||
[_this$client] = props; | ||
babelHelpers.classPrivateFieldSet(this, _client, _this$client); | ||
} | ||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "getClient", | ||
value: function getClient() { | ||
return babelHelpers.classPrivateFieldGet(this, _client); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
; | ||
[x, ..._classPrivateFieldDestructureSet(this, _client).value] = props; | ||
}; | ||
|
||
var _client = new WeakMap(); |
35 changes: 11 additions & 24 deletions
35
...gin-proposal-class-properties/test/fixtures/private/destructuring-array-pattern/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
var Foo = | ||
/*#__PURE__*/ | ||
function () { | ||
"use strict"; | ||
|
||
function Foo(props) { | ||
var _this$client; | ||
function _classPrivateFieldDestructureSet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } var descriptor = privateMap.get(receiver); if (descriptor.set) { if (!("__destrObj" in descriptor)) { descriptor.__destrObj = { set value(v) { descriptor.set.call(receiver, v); } }; } return descriptor.__destrObj; } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } return descriptor; } } | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
; | ||
[_this$client] = props; | ||
babelHelpers.classPrivateFieldSet(this, _client, _this$client); | ||
} | ||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
|
||
babelHelpers.createClass(Foo, [{ | ||
key: "getClient", | ||
value: function getClient() { | ||
return babelHelpers.classPrivateFieldGet(this, _client); | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
; | ||
[_classPrivateFieldDestructureSet(this, _client).value] = props; | ||
}; | ||
|
||
var _client = new WeakMap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...-proposal-class-properties/test/fixtures/private/destructuring-object-pattern-1/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
function _classPrivateFieldDestructureSet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } var descriptor = privateMap.get(receiver); if (descriptor.set) { if (!("__destrObj" in descriptor)) { descriptor.__destrObj = { set value(v) { descriptor.set.call(receiver, v); } }; } return descriptor.__destrObj; } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } return descriptor; } } | ||
|
||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
var _this$client; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
|
||
_client.set(this, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
|
||
babelHelpers.classPrivateFieldSet(this, _client, 'foo'); | ||
; | ||
({ | ||
client: _this$client | ||
x: this.x = babelHelpers.classPrivateFieldGet(this, _client), | ||
y: _classPrivateFieldDestructureSet(this, _client).value, | ||
z: this.z = babelHelpers.classPrivateFieldGet(this, _client) | ||
} = props); | ||
babelHelpers.classPrivateFieldSet(this, _client, _this$client); | ||
}; | ||
|
||
var _client = new WeakMap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters