diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-08 12:39:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-08 12:39:57 +0800 |
commit | c7cdcf06a65b70b557894c1680fc099d3c7aca6a (patch) | |
tree | ddcd4f34e8c11e0c7cfa942380d05e9ed66b06c4 /lib/compress.js | |
parent | 3ee55748d466f36aff54383b53fb3deca144de97 (diff) | |
download | tracifyjs-c7cdcf06a65b70b557894c1680fc099d3c7aca6a.tar.gz tracifyjs-c7cdcf06a65b70b557894c1680fc099d3c7aca6a.zip |
fix function name eliminiation (#1576)
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out.
fixes #1573
fixes #1575
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 85b457e3..f423fdd4 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2611,7 +2611,8 @@ merge(Compressor.prototype, { if (compressor.option("unused") && def.references.length == 1 && compressor.find_parent(AST_Scope) === def.scope) { - if (!compressor.option("keep_fnames")) { + if (!compressor.option("keep_fnames") + && exp.name && exp.name.definition() === def) { exp.name = null; } self.expression = exp; |