* Make @babel/plugin-class-features a normal helper package
This effectively disallows using it directly.
* Rename helper
* Style
* Don't add prefix to plugin name
* Move private methods plugin
This is similar to ec69b4bb1256c061ac76f53dfed09c4283ec6a31, which
was about private instance fields.
Private properties can be non-writable (thanks to decorators), or have
get/set accessors. If we stored this information on the `privateClass`
object, we would need to always use `Object.getOwnPropertyDescriptor`
before reading or writing a property because accessors need to be called
with the correct `this` context (it should be the actual class, not the
object hat stores the private properties). This commit simplifies that
operation a bit by removing the container object.
It also have another advantage, which instance fields already have
thanks to the use of separate weakmaps: unused private static fields
can be tree-shaken away or garbage-collected, while properties of an
object can't. Also, they can be easilier minified.
* Private Static Class Fields Implementation
* Redo testing without class transform for static private
* Add a call() test for private static
* Use Object.defineProperty in loose mode
* Save full descriptor instead of only value for private fields.
Decorators can make private fields non-writable, so we need to store this
information somewhere.
The descriptor can also be used to implement private accessors.
* Update member-expression-to-functions
1. Babel using British spellings, so `memoise`
2. Provide a helper `AssignmentMemoiser` class, which will assign the memo'd value with the `n`th access.
* Private properties!
* Fixes
* Tests
* Update helper name
* Fix privates that reference other privates
* Don't extend a builtin
* Rebase
This undoes the property call folding from #6656.
It complicates the private property transforms, since they boil down to `map.set(this, vlaue)` and we definitely don't want the next call define a property on the map.
/cc @Andarist
* Fix class properties after nested class' bare super
Fixes#7371.
* Fix node 4 test
* This damn node 4 test
* All of the ClassBody, but not the methods or field inits
* tmp
* tmp
* Use common class environment visitor
* Tests
* Use skipKey to avoid recursive traversal
* Remove old state
* Use jest expect
It was needed to avoid collision of identifiers used in fields
initializers with variables declared in the constructor, but it
broke `this` handling.
This commit removes that behavior and instead renames the
colliding variables.
* First implementation sketch and testcase
* Use helper instead of inline IIFE's
* minNodeVersion 6.0.0
* Hoisted visitor for subtraversal and fixed edgest case
* Resolve merge conflicts in helpers
* Remove duplicated helper from messing up Git