Implement class private property generation
MODIFY
packages/@romejs/js-generator/generators/classes/ClassPrivateProperty.ts
packages/@romejs/js-generator/generators/classes/ClassPrivateProperty.ts
* LICENSE file in the root directory of this source tree.
*/
-export default function ClassPrivateProperty() {
- throw new Error('unimplemented');
+import Generator from '../../Generator';
+import {AnyNode, classPrivateProperty} from '@romejs/js-ast';
+
+export default function ClassPrivateProperty(generator: Generator, node: AnyNode) {
+ node = classPrivateProperty.assert(node);
+
+ generator.print(node.meta, node);
+ generator.print(node.key, node);
+ generator.printTypeColon(node.typeAnnotation, node);
+
+ if (node.value) {
+ generator.space();
+ generator.token('=');
+ generator.space();
+ generator.print(node.value, node);
+ }
+
+ generator.semicolon();
}

MODIFY
packages/@romejs/js-generator/generators/classes/PrivateName.ts
packages/@romejs/js-generator/generators/classes/PrivateName.ts
* LICENSE file in the root directory of this source tree.
*/
-export default function PrivateName() {
- throw new Error('unimplemented');
+import Generator from '../../Generator';
+import {AnyNode, privateName} from '@romejs/js-ast';
+
+export default function PrivateName(generator: Generator, node: AnyNode) {
+ node = privateName.assert(node);
+
+ generator.token('#');
+ generator.print(node.id, node);
}

Implement class private property generation