forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...oposal-class-properties/test/fixtures/private-loose/destructuring-array-pattern-1/exec.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
this.#client = 1; | ||
;([this.x = this.#client, this.#client, this.y = this.#client] = props); | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo([undefined, 'bar']); | ||
expect(foo.getClient()).toBe('bar'); | ||
expect(foo.x).toBe(1); | ||
expect(foo.y).toBe('bar'); |
8 changes: 8 additions & 0 deletions
8
...posal-class-properties/test/fixtures/private-loose/destructuring-array-pattern-1/input.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
this.#client = 1; | ||
;([this.x = this.#client, this.#client, this.y = this.#client] = props); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...osal-class-properties/test/fixtures/private-loose/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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
babelHelpers.classPrivateFieldLooseBase(this, _client)[_client] = 1; | ||
; | ||
[this.x = babelHelpers.classPrivateFieldLooseBase(this, _client)[_client], babelHelpers.classPrivateFieldLooseBase(this, _client)[_client], this.y = babelHelpers.classPrivateFieldLooseBase(this, _client)[_client]] = props; | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |
15 changes: 15 additions & 0 deletions
15
...oposal-class-properties/test/fixtures/private-loose/destructuring-array-pattern-2/exec.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
let x; | ||
;([x, ...this.#client] = props); | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo(['foo', 'bar', 'baz', 'quu']); | ||
expect(foo.getClient()).toEqual(['bar', 'baz', 'quu']); |
7 changes: 7 additions & 0 deletions
7
...posal-class-properties/test/fixtures/private-loose/destructuring-array-pattern-2/input.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;([x, ...this.#client] = props); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...osal-class-properties/test/fixtures/private-loose/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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
; | ||
[x, ...babelHelpers.classPrivateFieldLooseBase(this, _client)[_client]] = props; | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |
14 changes: 14 additions & 0 deletions
14
...proposal-class-properties/test/fixtures/private-loose/destructuring-array-pattern/exec.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;([this.#client] = props); | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo(['bar']); | ||
expect(foo.getClient()).toBe('bar'); |
7 changes: 7 additions & 0 deletions
7
...roposal-class-properties/test/fixtures/private-loose/destructuring-array-pattern/input.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;([this.#client] = props); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...oposal-class-properties/test/fixtures/private-loose/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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
; | ||
[babelHelpers.classPrivateFieldLooseBase(this, _client)[_client]] = props; | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |
17 changes: 17 additions & 0 deletions
17
...posal-class-properties/test/fixtures/private-loose/destructuring-object-pattern-1/exec.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
this.#client = 'foo'; | ||
;({ x: this.x = this.#client, y: this.#client, z: this.z = this.#client } = props) | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo({ y: 'bar' }); | ||
expect(foo.getClient()).toBe('bar'); | ||
expect(foo.x).toBe('foo'); | ||
expect(foo.z).toBe('bar'); |
8 changes: 8 additions & 0 deletions
8
...osal-class-properties/test/fixtures/private-loose/destructuring-object-pattern-1/input.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
this.#client = 'foo'; | ||
;({ x: this.x = this.#client, y: this.#client, z: this.z = this.#client } = props) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...sal-class-properties/test/fixtures/private-loose/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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
babelHelpers.classPrivateFieldLooseBase(this, _client)[_client] = 'foo'; | ||
; | ||
({ | ||
x: this.x = babelHelpers.classPrivateFieldLooseBase(this, _client)[_client], | ||
y: babelHelpers.classPrivateFieldLooseBase(this, _client)[_client], | ||
z: this.z = babelHelpers.classPrivateFieldLooseBase(this, _client)[_client] | ||
} = props); | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |
15 changes: 15 additions & 0 deletions
15
...posal-class-properties/test/fixtures/private-loose/destructuring-object-pattern-2/exec.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
let x; | ||
;({ x, ...this.#client } = props) | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo({ x: 'foo', y: 'bar', z: 'baz' }); | ||
expect(foo.getClient()).toEqual({ y: 'bar', z: 'baz' }); |
7 changes: 7 additions & 0 deletions
7
...osal-class-properties/test/fixtures/private-loose/destructuring-object-pattern-2/input.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;({ x, ...this.#client } = props) | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...sal-class-properties/test/fixtures/private-loose/destructuring-object-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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
; | ||
({ | ||
x, | ||
...babelHelpers.classPrivateFieldLooseBase(this, _client)[_client] | ||
} = props); | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |
14 changes: 14 additions & 0 deletions
14
...roposal-class-properties/test/fixtures/private-loose/destructuring-object-pattern/exec.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;({ client: this.#client } = props) | ||
} | ||
|
||
getClient() { | ||
return this.#client; | ||
} | ||
} | ||
|
||
const foo = new Foo({ client: 'bar' }); | ||
expect(foo.getClient()).toBe('bar'); |
7 changes: 7 additions & 0 deletions
7
...oposal-class-properties/test/fixtures/private-loose/destructuring-object-pattern/input.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Foo { | ||
#client | ||
|
||
constructor(props) { | ||
;({ client: this.#client } = props) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...posal-class-properties/test/fixtures/private-loose/destructuring-object-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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var Foo = function Foo(props) { | ||
"use strict"; | ||
|
||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _client, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
; | ||
({ | ||
client: babelHelpers.classPrivateFieldLooseBase(this, _client)[_client] | ||
} = props); | ||
}; | ||
|
||
var _client = babelHelpers.classPrivateFieldLooseKey("client"); |