diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-11-11 15:30:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-11 15:30:17 +0800 |
commit | cda27b09703a0dfc8f84612a3d157a517f8ea4a9 (patch) | |
tree | 418cded020e9a8ef2d955f4013e41f154fd95730 /lib | |
parent | 3c740473686178c242f66d3ad330e1b047335b5f (diff) | |
download | tracifyjs-cda27b09703a0dfc8f84612a3d157a517f8ea4a9.tar.gz tracifyjs-cda27b09703a0dfc8f84612a3d157a517f8ea4a9.zip |
extend `reduce_funcs` to cover cross-scope substitutions (#2469)
fixes #2468
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index 2b38ed49..fdf3a2b6 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4256,10 +4256,11 @@ merge(Compressor.prototype, { var fixed = self.fixed_value(); if (fixed instanceof AST_Defun) { d.fixed = fixed = make_node(AST_Function, fixed, fixed); - if (!compressor.option("reduce_funcs")) d.single_use = false; } if (d.single_use && fixed instanceof AST_Function) { - if (d.escaped && d.scope !== self.scope || recursive_ref(compressor, d)) { + if (!compressor.option("reduce_funcs") && d.scope !== self.scope) { + d.single_use = false; + } else if (d.escaped && d.scope !== self.scope || recursive_ref(compressor, d)) { d.single_use = false; } else if (d.scope !== self.scope || d.orig[0] instanceof AST_SymbolFunarg) { d.single_use = fixed.is_constant_expression(self.scope); |