fix recursive function inline (#2738)

fixes #2737
This commit is contained in:
Alex Lam S.L
2018-01-07 15:31:24 +08:00
committed by GitHub
parent 8430c2f9f8
commit 1ee8be8d91
2 changed files with 49 additions and 2 deletions

View File

@@ -4075,9 +4075,10 @@ merge(Compressor.prototype, {
if (compressor.option("inline")
&& !fn.uses_arguments
&& !fn.uses_eval
&& !(fn.name && fn instanceof AST_Function)
&& (value = can_flatten_body(stat))
&& (exp === fn ? !fn.name
: compressor.option("unused")
&& (exp === fn
|| compressor.option("unused")
&& (def = exp.definition()).references.length == 1
&& !recursive_ref(compressor, def)
&& fn.is_constant_expression(exp.scope))