aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-04-27 09:51:21 +0100
committerGitHub <noreply@github.com>2020-04-27 16:51:21 +0800
commit818738beec9f49f864407c68fa26cc022c88815f (patch)
tree5a6548f3ce7c5338ba75eb8855829c7ec9d81c91
parentbc2a4a3bb8c08139c53d0d595181010ead516d77 (diff)
downloadtracifyjs-818738beec9f49f864407c68fa26cc022c88815f.tar.gz
tracifyjs-818738beec9f49f864407c68fa26cc022c88815f.zip
fix corner case in `ie8` (#3826)
fixes #3825
-rw-r--r--lib/compress.js2
-rw-r--r--test/compress/ie8.js15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a42095cf..8eb684d3 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4938,7 +4938,7 @@ merge(Compressor.prototype, {
}
if (!compressor.option("ie8")) return node;
if (node) exprs.push(node);
- return make_sequence(this, exprs);
+ return exprs.length == 0 ? null : make_sequence(this, exprs);
});
def(AST_Constant, return_null);
def(AST_Dot, function(compressor, first_in_statement) {
diff --git a/test/compress/ie8.js b/test/compress/ie8.js
index 8f81b01b..0c79ece0 100644
--- a/test/compress/ie8.js
+++ b/test/compress/ie8.js
@@ -2445,3 +2445,18 @@ issue_3823: {
}
expect_stdout: "PASS undefined"
}
+
+issue_3825: {
+ options = {
+ ie8: true,
+ pure_getters: "strict",
+ side_effects: true,
+ }
+ input: {
+ console.log({}[void (0..length ? 1 : 2)]);
+ }
+ expect: {
+ console.log({}[void 0]);
+ }
+ expect_stdout: "undefined"
+}