diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-27 18:09:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 18:09:35 +0800 |
commit | c526da59a1a9b1a1c5689cfdcc840b36850ed250 (patch) | |
tree | da61f10df9b980d1c6515dbb5697b85606c311f8 /lib | |
parent | 581630e0a71cffeadd4887a757889d6a3502275c (diff) | |
download | tracifyjs-c526da59a1a9b1a1c5689cfdcc840b36850ed250.tar.gz tracifyjs-c526da59a1a9b1a1c5689cfdcc840b36850ed250.zip |
`has_side_effects()` should take `AST_Switch.expression` into account (#1699)
fixes #1698
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index 03c8d5dd..1146f300 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1610,9 +1610,13 @@ merge(Compressor.prototype, { def(AST_Block, function(compressor){ return any(this.body, compressor); }); + def(AST_Switch, function(compressor){ + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); + }); def(AST_Case, function(compressor){ - return any(this.body, compressor) - || this.expression.has_side_effects(compressor); + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); }); def(AST_Try, function(compressor){ return any(this.body, compressor) |