aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-08 03:31:51 +0800
committerGitHub <noreply@github.com>2018-02-08 03:31:51 +0800
commitd66d86f20bc231bd8d305ee5ba05efa77aa8b6be (patch)
tree1eae73edc0f4fab7d3dbffc5dd94736953ac6dbf /lib
parent905325d3e21a5dc3d3f5835f609f30055c25bf2b (diff)
downloadtracifyjs-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.js9
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)