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
1 parent
47be7f8
commit 46b0e7a
Showing
14 changed files
with
214 additions
and
44 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
12 changes: 12 additions & 0 deletions
12
...chaining-assign/test/fixtures/assumption-noDocumentAll/private-field-transformed/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,12 @@ | ||
class A { | ||
#x; | ||
|
||
method() { | ||
obj?.#x = 1; | ||
obj?.#x += 2; | ||
obj?.#x ??= 3; | ||
obj?.#x.y = 4; | ||
obj?.#x.y += 5; | ||
obj?.#x.y ??= 6; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ning-assign/test/fixtures/assumption-noDocumentAll/private-field-transformed/options.json
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,6 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-optional-chaining-assign", { "version": "2023-07" }], | ||
"transform-class-properties" | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
...haining-assign/test/fixtures/assumption-noDocumentAll/private-field-transformed/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 _x = /*#__PURE__*/new WeakMap(); | ||
class A { | ||
constructor() { | ||
babelHelpers.classPrivateFieldInitSpec(this, _x, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
method() { | ||
var _obj, _obj2, _obj3, _obj4, _obj5, _obj6; | ||
(_obj = obj) == null ? void 0 : babelHelpers.classPrivateFieldSet(_obj, _x, 1); | ||
(_obj2 = obj) == null ? void 0 : babelHelpers.classPrivateFieldSet(_obj2, _x, babelHelpers.classPrivateFieldGet(_obj2, _x) + 2); | ||
(_obj3 = obj) == null ? void 0 : babelHelpers.classPrivateFieldGet(_obj3, _x) ?? babelHelpers.classPrivateFieldSet(_obj3, _x, 3); | ||
(_obj4 = obj) == null ? void 0 : babelHelpers.classPrivateFieldGet(_obj4, _x).y = 4; | ||
(_obj5 = obj) == null ? void 0 : babelHelpers.classPrivateFieldGet(_obj5, _x).y += 5; | ||
(_obj6 = obj) == null ? void 0 : babelHelpers.classPrivateFieldGet(_obj6, _x).y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...al-optional-chaining-assign/test/fixtures/assumption-noDocumentAll/private-field/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,12 @@ | ||
class A { | ||
#x; | ||
|
||
method() { | ||
obj?.#x = 1; | ||
obj?.#x += 2; | ||
obj?.#x ??= 3; | ||
obj?.#x.y = 4; | ||
obj?.#x.y += 5; | ||
obj?.#x.y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...l-optional-chaining-assign/test/fixtures/assumption-noDocumentAll/private-field/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,12 @@ | ||
class A { | ||
#x; | ||
method() { | ||
var _obj, _obj2, _obj3, _obj4, _obj5, _obj6; | ||
(_obj = obj) == null ? void 0 : _obj.#x = 1; | ||
(_obj2 = obj) == null ? void 0 : _obj2.#x += 2; | ||
(_obj3 = obj) == null ? void 0 : _obj3.#x ??= 3; | ||
(_obj4 = obj) == null ? void 0 : _obj4.#x.y = 4; | ||
(_obj5 = obj) == null ? void 0 : _obj5.#x.y += 5; | ||
(_obj6 = obj) == null ? void 0 : _obj6.#x.y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...assign/test/fixtures/general/private-field-transformed-privateFieldsAsProperties/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,12 @@ | ||
class A { | ||
#x; | ||
|
||
method() { | ||
obj?.#x = 1; | ||
obj?.#x += 2; | ||
obj?.#x ??= 3; | ||
obj?.#x.y = 4; | ||
obj?.#x.y += 5; | ||
obj?.#x.y ??= 6; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...gn/test/fixtures/general/private-field-transformed-privateFieldsAsProperties/options.json
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,9 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-optional-chaining-assign", { "version": "2023-07" }], | ||
"transform-class-properties" | ||
], | ||
"assumptions": { | ||
"privateFieldsAsProperties": true | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ssign/test/fixtures/general/private-field-transformed-privateFieldsAsProperties/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 _x = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("x"); | ||
class A { | ||
constructor() { | ||
Object.defineProperty(this, _x, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
method() { | ||
var _obj, _obj2, _obj3, _obj4, _obj5, _obj6; | ||
(_obj = obj) === null || _obj === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj, _x)[_x] = 1; | ||
(_obj2 = obj) === null || _obj2 === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj2, _x)[_x] += 2; | ||
(_obj3 = obj) === null || _obj3 === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj3, _x)[_x] ??= 3; | ||
(_obj4 = obj) === null || _obj4 === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj4, _x)[_x].y = 4; | ||
(_obj5 = obj) === null || _obj5 === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj5, _x)[_x].y += 5; | ||
(_obj6 = obj) === null || _obj6 === void 0 ? void 0 : babelHelpers.classPrivateFieldLooseBase(_obj6, _x)[_x].y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...roposal-optional-chaining-assign/test/fixtures/general/private-field-transformed/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,12 @@ | ||
class A { | ||
#x; | ||
|
||
method() { | ||
obj?.#x = 1; | ||
obj?.#x += 2; | ||
obj?.#x ??= 3; | ||
obj?.#x.y = 4; | ||
obj?.#x.y += 5; | ||
obj?.#x.y ??= 6; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...sal-optional-chaining-assign/test/fixtures/general/private-field-transformed/options.json
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,6 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-optional-chaining-assign", { "version": "2023-07" }], | ||
"transform-class-properties" | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
...oposal-optional-chaining-assign/test/fixtures/general/private-field-transformed/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 _x = /*#__PURE__*/new WeakMap(); | ||
class A { | ||
constructor() { | ||
babelHelpers.classPrivateFieldInitSpec(this, _x, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
method() { | ||
var _obj, _obj2, _obj3, _obj4, _obj5, _obj6; | ||
(_obj = obj) === null || _obj === void 0 ? void 0 : babelHelpers.classPrivateFieldSet(_obj, _x, 1); | ||
(_obj2 = obj) === null || _obj2 === void 0 ? void 0 : babelHelpers.classPrivateFieldSet(_obj2, _x, babelHelpers.classPrivateFieldGet(_obj2, _x) + 2); | ||
(_obj3 = obj) === null || _obj3 === void 0 ? void 0 : babelHelpers.classPrivateFieldGet(_obj3, _x) ?? babelHelpers.classPrivateFieldSet(_obj3, _x, 3); | ||
(_obj4 = obj) === null || _obj4 === void 0 ? void 0 : babelHelpers.classPrivateFieldGet(_obj4, _x).y = 4; | ||
(_obj5 = obj) === null || _obj5 === void 0 ? void 0 : babelHelpers.classPrivateFieldGet(_obj5, _x).y += 5; | ||
(_obj6 = obj) === null || _obj6 === void 0 ? void 0 : babelHelpers.classPrivateFieldGet(_obj6, _x).y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...bel-plugin-proposal-optional-chaining-assign/test/fixtures/general/private-field/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,12 @@ | ||
class A { | ||
#x; | ||
|
||
method() { | ||
obj?.#x = 1; | ||
obj?.#x += 2; | ||
obj?.#x ??= 3; | ||
obj?.#x.y = 4; | ||
obj?.#x.y += 5; | ||
obj?.#x.y ??= 6; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...el-plugin-proposal-optional-chaining-assign/test/fixtures/general/private-field/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,12 @@ | ||
class A { | ||
#x; | ||
method() { | ||
var _obj, _obj2, _obj3, _obj4, _obj5, _obj6; | ||
(_obj = obj) === null || _obj === void 0 ? void 0 : _obj.#x = 1; | ||
(_obj2 = obj) === null || _obj2 === void 0 ? void 0 : _obj2.#x += 2; | ||
(_obj3 = obj) === null || _obj3 === void 0 ? void 0 : _obj3.#x ??= 3; | ||
(_obj4 = obj) === null || _obj4 === void 0 ? void 0 : _obj4.#x.y = 4; | ||
(_obj5 = obj) === null || _obj5 === void 0 ? void 0 : _obj5.#x.y += 5; | ||
(_obj6 = obj) === null || _obj6 === void 0 ? void 0 : _obj6.#x.y ??= 6; | ||
} | ||
} |