Ujjwal Sharma 2ac49ba7c4
add support for logical assignments with private properties (#11702)
* add support for logical assignments with private properties

Patches the logic for handling assignment operators and adds support for
handling the logical assignment operators appropriately.

Fixes: https://github.com/babel/babel/issues/11646

* replace hardcoded logical assignment operators with constant

Replace a hardcoded check for logical assignment operators with the
LOGICAL_OPERATORS constant in
plugin-proposal-logical-assignment-operators.

Refs: https://github.com/babel/babel/pull/11702#discussion_r438554423
2020-07-30 14:10:16 -04:00

18 lines
203 B
JavaScript

class Foo {
#nullish = 0;
#and = 0;
#or = 0;
self() {
return this;
}
test() {
this.#nullish ??= 42;
this.#and &&= 0;
this.#or ||= 0;
this.self().#nullish ??= 42;
}
}