diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-03-15 05:45:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-15 05:45:46 +0800 |
commit | 8d2e6f333e750decdde50e3135efa8b560d56a42 (patch) | |
tree | f4df992848c6740ba586c26038738380a2b0c077 /lib | |
parent | b3ef5e514dd0cefeba926401d2538907a8712b99 (diff) | |
download | tracifyjs-8d2e6f333e750decdde50e3135efa8b560d56a42.tar.gz tracifyjs-8d2e6f333e750decdde50e3135efa8b560d56a42.zip |
fix function inlining after `reduce_vars` (#3340)
fixes #3297
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 8 |
1 files changed, 8 insertions, 0 deletions
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 { |