aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-05-11 18:55:45 +0800
committerGitHub <noreply@github.com>2019-05-11 18:55:45 +0800
commit9fc8cd40763467d8b256be00380965268b7afcfd (patch)
treea96536e67f89b94a660e20b7bebabed39b0421e8 /lib/compress.js
parent5476cb8f05d0e7d402d583ef726e743451555c10 (diff)
downloadtracifyjs-9fc8cd40763467d8b256be00380965268b7afcfd.tar.gz
tracifyjs-9fc8cd40763467d8b256be00380965268b7afcfd.zip
fix corner case in `functions` (#3403)
fixes #3402
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 418b1d54..b63c0512 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3682,6 +3682,7 @@ merge(Compressor.prototype, {
} else if (compressor.option("functions")
&& def.value === def.name.fixed_value()
&& def.value instanceof AST_Function
+ && !(def.value.name && def.value.name.definition().assignments)
&& can_rename(def.value, def.name.name)
&& (!compressor.has_directive("use strict") || parent instanceof AST_Scope)) {
AST_Node.warn("Declaring {name} as function [{file}:{line},{col}]", template(def.name));
@@ -6301,6 +6302,13 @@ merge(Compressor.prototype, {
expression: self.left
});
}
+ if (!compressor.option("ie8") && self.left instanceof AST_Symbol && self.left.is_immutable()) {
+ return (self.operator == "=" ? self.right : make_node(AST_Binary, self, {
+ operator: self.operator.slice(0, -1),
+ left: self.left,
+ right: self.right
+ })).optimize(compressor);
+ }
return self;
function in_try(level, node) {