From a8e286f7e1edcdf9b42b057319963c6ed3c47348 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Thu, 6 Aug 2020 13:30:28 +0100 Subject: fix corner case in `collapse_vars` (#4041) fixes #4040 --- lib/compress.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/compress.js') 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() { -- cgit v1.2.3