diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-08-06 13:30:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 20:30:28 +0800 |
commit | a8e286f7e1edcdf9b42b057319963c6ed3c47348 (patch) | |
tree | 6630b7d14a8a42a2f5be32f74e1bd59a3b2e7d2f /lib/compress.js | |
parent | 9b05494ebcbcc40a6682cf570aa183f045244650 (diff) | |
download | tracifyjs-a8e286f7e1edcdf9b42b057319963c6ed3c47348.tar.gz tracifyjs-a8e286f7e1edcdf9b42b057319963c6ed3c47348.zip |
fix corner case in `collapse_vars` (#4041)
fixes #4040
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js index 7131e104..9c1fc3a9 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1549,10 +1549,9 @@ merge(Compressor.prototype, { return lvalues.has(node.name.name) || side_effects && may_modify(node.name); } var sym = is_lhs(node.left, node); - if (!sym) return false; - return lvalues.has(sym.name) - || sym instanceof AST_PropAccess - || read_toplevel && compressor.exposed(sym.definition()); + if (sym instanceof AST_PropAccess) return true; + if (!(sym instanceof AST_SymbolRef)) return false; + return lvalues.has(sym.name) || read_toplevel && compressor.exposed(sym.definition()); } function extract_args() { |