Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transformer): class properties transform (#7011)
Add class properties transform. Implementation is incomplete. Notable missing parts: * Scopes are not updated where property initializers move from class body into class constructor / `_super` function. * Does not handle binding shadowing problems when property initializers move from class body into class constructor. * `this` and references to class name in static property initializers need to be transformed to point to a temp var. * Not all usages of private properties are supported (see below). * Code which is moved to outside of class body is not transformed by other transforms for class declarations (works OK for class expressions). This includes static property initializers, static blocks, and computed property/method keys. * Only basic checks for whether computed property/method keys may have side effects. * Numerous other small issues noted in TODO comments through the code. ### Private properties Currently does not handle the following usages of private properties: ```js class Class { #prop; static #static; method() { object?.#prop; object?.#prop(); [object.#prop] = [1]; ({x: object.#prop} = {x: 1}); object.#prop`xyz`; object?.#static; object?.#static(); [object.#static] = [1]; ({x: object.#static} = {x: 1}); object.#static`xyz`; } } ```
- Loading branch information