aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-05 05:18:01 +0000
committerGitHub <noreply@github.com>2021-03-05 13:18:01 +0800
commitdd30ed6a9bf108f05b103eef81d84f91ae4c6322 (patch)
tree206a02f962fcbbec0a3747789e6a17b56b31e815 /lib/compress.js
parentcb50a2d192ef8be1aac7577d6ec9c06f27b71232 (diff)
downloadtracifyjs-dd30ed6a9bf108f05b103eef81d84f91ae4c6322.tar.gz
tracifyjs-dd30ed6a9bf108f05b103eef81d84f91ae4c6322.zip
enhance `collapse_vars` (#4735)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6a59a9d5..c9ba218d 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2068,8 +2068,9 @@ merge(Compressor.prototype, {
if (node instanceof AST_ObjectIdentity) return symbol_in_lvalues(node, parent);
if (node instanceof AST_PropAccess) {
var exp = node.expression;
- return side_effects || !value_def && exp.may_throw_on_access(compressor)
- || exp instanceof AST_SymbolRef && is_arguments(exp.definition());
+ return side_effects
+ || exp instanceof AST_SymbolRef && is_arguments(exp.definition())
+ || !value_def && (in_try || !lhs_local) && exp.may_throw_on_access(compressor);
}
if (node instanceof AST_Spread) return true;
if (node instanceof AST_SymbolRef) {