disallow collapse_vars constant replacement in for-in statements (#1543)
This commit is contained in:
@@ -525,11 +525,9 @@ merge(Compressor.prototype, {
|
|||||||
// Constant single use vars can be replaced in any scope.
|
// Constant single use vars can be replaced in any scope.
|
||||||
if (var_decl.value.is_constant()) {
|
if (var_decl.value.is_constant()) {
|
||||||
var ctt = new TreeTransformer(function(node) {
|
var ctt = new TreeTransformer(function(node) {
|
||||||
if (node === ref) {
|
if (node === ref
|
||||||
var parent = ctt.parent();
|
&& !ctt.find_parent(AST_ForIn)) {
|
||||||
if (!(parent instanceof AST_ForIn && parent.init === node)) {
|
return replace_var(node, ctt.parent(), true);
|
||||||
return replace_var(node, parent, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stat.transform(ctt);
|
stat.transform(ctt);
|
||||||
|
|||||||
Reference in New Issue
Block a user