-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix class private properties when
privateFieldsAsProperties
(#16275)
- Loading branch information
1 parent
d78fef8
commit f30a8fd
Showing
92 changed files
with
374 additions
and
336 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
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
6 changes: 3 additions & 3 deletions
6
...class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/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,9 +1,9 @@ | ||
var _privateMethod = /*#__PURE__*/new WeakSet(); | ||
var _X_brand = /*#__PURE__*/new WeakSet(); | ||
class X { | ||
constructor() { | ||
babelHelpers.classPrivateMethodInitSpec(this, _privateMethod); | ||
babelHelpers.classPrivateMethodInitSpec(this, _X_brand); | ||
} | ||
} | ||
function _privateMethod2() { | ||
function _privateMethod() { | ||
return 42; | ||
} |
18 changes: 18 additions & 0 deletions
18
...te-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/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,18 @@ | ||
class X { | ||
#privateMethod() { | ||
return 1; | ||
} | ||
#privateMethod2() { | ||
return 2; | ||
} | ||
method1() { | ||
return this.#privateMethod(); | ||
} | ||
method2() { | ||
return this.#privateMethod2(); | ||
} | ||
} | ||
|
||
const x = new X(); | ||
expect(x.method1()).toBe(1); | ||
expect(x.method2()).toBe(2); |
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 |
---|---|---|
|
@@ -2,4 +2,7 @@ class X { | |
#privateMethod() { | ||
return 42; | ||
} | ||
#privateMethod2() { | ||
return 42; | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...s/babel-helper-create-class-features-plugin/test/fixtures/replace-supers/method/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,13 +1,13 @@ | ||
var _A; | ||
var _foo = /*#__PURE__*/new WeakSet(); | ||
var _A_brand = /*#__PURE__*/new WeakSet(); | ||
class A extends B { | ||
constructor(...args) { | ||
super(...args); | ||
babelHelpers.classPrivateMethodInitSpec(this, _foo); | ||
babelHelpers.classPrivateMethodInitSpec(this, _A_brand); | ||
} | ||
} | ||
_A = A; | ||
function _foo2() { | ||
function _foo() { | ||
let _A2; | ||
babelHelpers.get(babelHelpers.getPrototypeOf(_A.prototype), "x", this); | ||
} |
4 changes: 2 additions & 2 deletions
4
...l-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/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
4 changes: 2 additions & 2 deletions
4
...posal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/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
10 changes: 5 additions & 5 deletions
10
...xtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/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
6 changes: 3 additions & 3 deletions
6
...bel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/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
8 changes: 4 additions & 4 deletions
8
...roposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/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
6 changes: 3 additions & 3 deletions
6
...bel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/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
4 changes: 2 additions & 2 deletions
4
...l-plugin-proposal-decorators/test/fixtures/2022-03-accessors--to-es2015/private/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
4 changes: 2 additions & 2 deletions
4
...posal-decorators/test/fixtures/2022-03-accessors--to-es2015/undecorated-private/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
10 changes: 5 additions & 5 deletions
10
...xtures/2022-03-classes--to-es2015/replacement-static-installed-on-correct-class/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
6 changes: 3 additions & 3 deletions
6
...bel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/private/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
8 changes: 4 additions & 4 deletions
8
...roposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/private/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
6 changes: 3 additions & 3 deletions
6
...bel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/private/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
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
Oops, something went wrong.