patch up #1543 for harmony

fixes #1537
This commit is contained in:
kzc
2017-03-05 16:15:13 +08:00
committed by alexlamsl
parent 49d9ac1c43
commit 33a26d456b
2 changed files with 80 additions and 0 deletions

View File

@@ -549,6 +549,7 @@ merge(Compressor.prototype, {
if (var_decl.value.is_constant()) {
var ctt = new TreeTransformer(function(node) {
if (node === ref
&& !ctt.find_parent(AST_Destructuring)
&& !ctt.find_parent(AST_ForIn)) {
return replace_var(node, ctt.parent(), true);
}
@@ -581,6 +582,7 @@ merge(Compressor.prototype, {
if (unwind) return node;
var parent = tt.parent();
if (node instanceof AST_Lambda
|| node instanceof AST_Destructuring
|| node instanceof AST_Try
|| node instanceof AST_With
|| node instanceof AST_Case