* Modify grammar to support Private Fields proposal: - Adding optional plugin `classPrivateProperties` - Adding PrivateName type identifier - Adding ClassPrivateProperty to ClassBody - Allow PrivateName in MemberExpression - Allow PrivateName as a reference - Adding tests * Remove unnecesary liberal parameter * Guarding for plugin dependecy for future versioning * update spec.md [skip ci] * move comment [skip ci] * remove unused param [skip ci] * Refactor PrivateName to contain Identifier in name property
20 lines
330 B
JavaScript
20 lines
330 B
JavaScript
class Point {
|
|
#x;
|
|
#y;
|
|
|
|
constructor(x = 0, y = 0) {
|
|
#x = +x;
|
|
#y = +y;
|
|
}
|
|
|
|
get x() { return #x }
|
|
set x(value) { #x = +value }
|
|
|
|
get y() { return #y }
|
|
set y(value) { #y = +value }
|
|
|
|
equals(p) { return #x === p.#x && #y === p.#y }
|
|
|
|
toString() { return `Point<${ #x },${ #y }>` }
|
|
}
|