From 8d2e6f333e750decdde50e3135efa8b560d56a42 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 15 Mar 2019 05:45:46 +0800 Subject: fix function inlining after `reduce_vars` (#3340) fixes #3297 --- lib/compress.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/compress.js') diff --git a/lib/compress.js b/lib/compress.js index b5d155ea..43fd561e 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -5830,6 +5830,14 @@ merge(Compressor.prototype, { lambda_def.references.push(node); } else { def.single_use = false; + var fn = node.fixed_value(); + if (!(fn instanceof AST_Lambda)) return; + if (!fn.name) return; + if (!fixed.variables.get(fn.name.name)) return; + fn.name = fn.name.clone(); + var value_def = value.variables.get(fn.name.name) || value.def_function(fn.name); + node.thedef = value_def; + value_def.references.push(node); } })); } else { -- cgit v1.2.3