Class static private field destructure set#12917
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/43590/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c5e03f9:
|
| @@ -0,0 +1,29 @@ | |||
| expect(() => { | |||
There was a problem hiding this comment.
Yeah, this one is based on #12910, see https://github.com/babel/babel/pull/12917/files/dd660bce888e8e06a7e11430d796b8fa54a3ffd4..3a307137ac24195afb30acd18f240d03a48c6cd9 for the real diff.
| @@ -0,0 +1,9 @@ | |||
| class A { | |||
| run() { | |||
| babelHelpers.classStaticPrivateMethodSet(A, A, _method, 2); | |||
There was a problem hiding this comment.
In a followup, we need to make this better. We're passing _method where we expect descriptor.
There was a problem hiding this comment.
In Babel 8 I'd like to just remove the concept of descriptors for private elements.
I introduced them for decorators, but the decorators proposal has evolved to be more static and now we don't need runtime descriptors anymore.
4dcd489 to
3910050
Compare
|
|
9db2859 to
4eef5ce
Compare
4eef5ce to
c5e03f9
Compare
Pending Nicolò's review on helper refactors
| @@ -1299,24 +1299,90 @@ helpers.classPrivateFieldLooseBase = helper("7.0.0-beta.0")` | |||
| `; | |||
|
|
|||
| helpers.classPrivateFieldGet = helper("7.0.0-beta.0")` | |||
There was a problem hiding this comment.
We don't need to bump the version because it's functionally equivalent, right?
There was a problem hiding this comment.
Yes. Refactoring internals helpers should not bump minimal required helper version as long as the interface is not changed.
[C.#p] = [0](REPL)This PR depends on #12910, please review that one first.
In this PR we introduce a new helper
classStaticPrivateFieldDestructureSetsimilar toclassPrivateFieldDestructureSetexcept that it accepts a classRef and descriptor. From this perspective this PR can be considered thestaticflavor of #10017.