From e6b8ee645d0e9fa3cc6ff4bb30d2a15e2289a88b Mon Sep 17 00:00:00 2001 From: David Bonnet Date: Thu, 28 Apr 2022 12:51:48 +0200 Subject: [PATCH] fix: Does not handle undefined private properties Fixes #609 --- src/astring.js | 3 +++ src/tests/fixtures/syntax/class.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/astring.js b/src/astring.js index 01904720..9f54e1ea 100644 --- a/src/astring.js +++ b/src/astring.js @@ -826,6 +826,9 @@ export const GENERATOR = { state.write('static ') } this[node.key.type](node.key, state) + if (node.value == null) { + return + } state.write(' = ') this[node.value.type](node.value, state) }, diff --git a/src/tests/fixtures/syntax/class.js b/src/tests/fixtures/syntax/class.js index fe9ee976..344c517c 100644 --- a/src/tests/fixtures/syntax/class.js +++ b/src/tests/fixtures/syntax/class.js @@ -51,6 +51,7 @@ class O { #a = 42 #b() {} static #c = 'C' + #d static { const a = 3; }