fix escape analysis on AST_New (#3043)

fixes #3042
This commit is contained in:
Alex Lam S.L
2018-03-31 15:03:46 +09:00
committed by GitHub
parent 6982a0554c
commit 07f64d4050
2 changed files with 73 additions and 1 deletions

View File

@@ -428,7 +428,7 @@ merge(Compressor.prototype, {
var parent = tw.parent(level);
if (value && value.is_constant()) return;
if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right
|| parent instanceof AST_Call && node !== parent.expression
|| parent instanceof AST_Call && (node !== parent.expression || parent instanceof AST_New)
|| parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope
|| parent instanceof AST_VarDef && node === parent.value) {
if (depth > 1 && !(value && value.is_constant_expression(scope))) depth = 1;