diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-08 03:31:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-08 03:31:51 +0800 |
commit | d66d86f20bc231bd8d305ee5ba05efa77aa8b6be (patch) | |
tree | 1eae73edc0f4fab7d3dbffc5dd94736953ac6dbf /lib | |
parent | 905325d3e21a5dc3d3f5835f609f30055c25bf2b (diff) | |
download | tracifyjs-d66d86f20bc231bd8d305ee5ba05efa77aa8b6be.tar.gz tracifyjs-d66d86f20bc231bd8d305ee5ba05efa77aa8b6be.zip |
account for exceptions in `AST_Assign.left` (#2892)
fixes #2891
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index 142728c2..dc453f14 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2758,8 +2758,13 @@ merge(Compressor.prototype, { return any(this.elements, compressor); }); def(AST_Assign, function(compressor){ - return this.operator != "=" && this.left.may_throw(compressor) - || this.right.may_throw(compressor); + if (this.right.may_throw(compressor)) return true; + if (!compressor.has_directive("use strict") + && this.operator == "=" + && this.left instanceof AST_SymbolRef) { + return false; + } + return this.left.may_throw(compressor); }); def(AST_Binary, function(compressor){ return this.left.may_throw(compressor) |