aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-14 16:39:35 +0100
committerGitHub <noreply@github.com>2020-10-14 23:39:35 +0800
commit3d71e97dd100fe150db3a5585d744e109bfa53ac (patch)
tree32dcd852a9e9ef5f0e50252b1af10bb9eb1e29d0 /lib/output.js
parent7f35d9cee05528574a24cbdad5593403db07cbf0 (diff)
downloadtracifyjs-3d71e97dd100fe150db3a5585d744e109bfa53ac.tar.gz
tracifyjs-3d71e97dd100fe150db3a5585d744e109bfa53ac.zip
fix corner cases in `braces` & `sequences` (#4221)
fixes #4220
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/output.js b/lib/output.js
index 7077d6dd..70bd74be 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -990,7 +990,7 @@ function OutputStream(options) {
/* -----[ if ]----- */
function make_then(self, output) {
var b = self.body;
- if (output.option("braces")
+ if (output.option("braces") && !(b instanceof AST_Const)
|| output.option("ie8") && b instanceof AST_Do)
return make_block(b, output);
// The squeezer replaces "block"-s that contain only a single
@@ -1381,7 +1381,7 @@ function OutputStream(options) {
});
function force_statement(stat, output) {
- if (output.option("braces")) {
+ if (output.option("braces") && !(stat instanceof AST_Const)) {
make_block(stat, output);
} else if (!stat || stat instanceof AST_EmptyStatement) {
output.force_semicolon();