-
-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transformer): exponentiation transform: support private fields (#…
…6345) Babel doesn't support private fields in this transform, but there's no reason not to. So we can.
- Loading branch information
1 parent
bd5fb5a
commit cf20f3a
Showing
5 changed files
with
105 additions
and
23 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
9 changes: 0 additions & 9 deletions
9
...l-plugin-transform-exponentiation-operator/test/fixtures/bail-private-properties/input.js
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...-plugin-transform-exponentiation-operator/test/fixtures/bail-private-properties/output.js
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
.../babel-plugin-transform-exponentiation-operator/test/fixtures/private-properties/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,11 @@ | ||
class C { | ||
#p = 1; | ||
|
||
method(obj) { | ||
this.#p **= 1; | ||
obj.#p **= 2; | ||
this.x.y.z.#p **= 3; | ||
obj.x.y.z.#p **= 4; | ||
fn().x.y.z.#p **= 5; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...babel-plugin-transform-exponentiation-operator/test/fixtures/private-properties/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 C { | ||
#p = 1; | ||
|
||
method(obj) { | ||
var _this, _this$x$y$z, _obj$x$y$z, _fn$x$y$z; | ||
_this = this, _this.#p = Math.pow(_this.#p, 1); | ||
obj.#p = Math.pow(obj.#p, 2); | ||
_this$x$y$z = this.x.y.z, _this$x$y$z.#p = Math.pow(_this$x$y$z.#p, 3); | ||
_obj$x$y$z = obj.x.y.z, _obj$x$y$z.#p = Math.pow(_obj$x$y$z.#p, 4); | ||
_fn$x$y$z = fn().x.y.z, _fn$x$y$z.#p = Math.pow(_fn$x$y$z.#p, 5); | ||
} | ||
} |