diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-19 01:32:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 08:32:39 +0800 |
commit | 96bf7fceabf1670ca07c08a04a3130e742775c8f (patch) | |
tree | 71a28df4db6ce0ec1a5e0423dad6b74ab00fa065 /lib/output.js | |
parent | 6c7226c10ef1328c726ce7c5d364efed8ed0d374 (diff) | |
download | tracifyjs-96bf7fceabf1670ca07c08a04a3130e742775c8f.tar.gz tracifyjs-96bf7fceabf1670ca07c08a04a3130e742775c8f.zip |
support `let` (#4227)
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/output.js b/lib/output.js index 70bd74be..8068648e 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") && !(b instanceof AST_Const) + if (output.option("braces") && !(b instanceof AST_Const || b instanceof AST_Let) || output.option("ie8") && b instanceof AST_Do) return make_block(b, output); // The squeezer replaces "block"-s that contain only a single @@ -1124,6 +1124,7 @@ function OutputStream(options) { }; } DEFPRINT(AST_Const, print_definitinos("const")); + DEFPRINT(AST_Let, print_definitinos("let")); DEFPRINT(AST_Var, print_definitinos("var")); function parenthesize_for_noin(node, output, noin) { @@ -1381,7 +1382,7 @@ function OutputStream(options) { }); function force_statement(stat, output) { - if (output.option("braces") && !(stat instanceof AST_Const)) { + if (output.option("braces") && !(stat instanceof AST_Const || stat instanceof AST_Let)) { make_block(stat, output); } else if (!stat || stat instanceof AST_EmptyStatement) { output.force_semicolon(); |