From 01f1841a23b317cc91a6336ce2e34ef0a080cad9 Mon Sep 17 00:00:00 2001 From: fabiosantoscode Date: Sat, 2 Oct 2021 08:52:37 +0000 Subject: [PATCH] allow 'get;' as a class property without value. Closes #1078 --- lib/parse.js | 2 +- test/compress/class-properties.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index 55333b54e..3e0cd8b13 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -2551,7 +2551,7 @@ function parse($TEXT, options) { }; const is_not_method_start = () => - !is("punc", "(") && !is("punc", ",") && !is("punc", "}") && !is("operator", "="); + !is("punc", "(") && !is("punc", ",") && !is("punc", "}") && !is("punc", ";") && !is("operator", "="); var is_async = false; var is_static = false; diff --git a/test/compress/class-properties.js b/test/compress/class-properties.js index 0fda90bb4..b98d31aa7 100644 --- a/test/compress/class-properties.js +++ b/test/compress/class-properties.js @@ -9,11 +9,13 @@ basic_class_properties: { = "P" another = "A"; + get; + set = "S"; #private; - #private2 = "SS"; + #private2 = "S"; toString() { if ('bar' in this && 'foo' in A) { - return A.fil + this.another + this.#private2 + return A.fil + this.another + this.set + this.#private2 } } }