diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-04 15:53:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 15:53:53 +0800 |
commit | 7a6d452b548c8b7783b226f646e814d6cb0cf32b (patch) | |
tree | 69f30a000b07a4dc62d420002f25c5fb8648efba /lib/compress.js | |
parent | 9b58b54e2d7ce4ab2c015611add52c7475de9eab (diff) | |
download | tracifyjs-7a6d452b548c8b7783b226f646e814d6cb0cf32b.tar.gz tracifyjs-7a6d452b548c8b7783b226f646e814d6cb0cf32b.zip |
preserve constant modification under strict mode (#2717)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 85bb0910..fe504164 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -3279,7 +3279,12 @@ merge(Compressor.prototype, { }); def(AST_Assign, function(compressor){ var left = this.left; - if (left.has_side_effects(compressor)) return this; + if (left.has_side_effects(compressor) + || compressor.has_directive("use strict") + && left instanceof AST_PropAccess + && left.expression.is_constant()) { + return this; + } this.write_only = true; while (left instanceof AST_PropAccess) { left = left.expression; |