public
/
UglifyJS.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
07accd2
)
disallow collapse_vars constant replacement in for-in statements (#1543)
author
kzc
<kzc@users.noreply.github.com>
Fri, 3 Mar 2017 18:39:54 +0000
(13:39 -0500)
committer
Alex Lam S.L
<alexlamsl@gmail.com>
Fri, 3 Mar 2017 18:39:54 +0000
(
02:39
+0800)
lib/compress.js
patch
|
blob
|
history
diff --git
a/lib/compress.js
b/lib/compress.js
index
2cd7912
..
3545900
100644
(file)
--- a/
lib/compress.js
+++ b/
lib/compress.js
@@
-525,11
+525,9
@@
merge(Compressor.prototype, {
// Constant single use vars can be replaced in any scope.
if (var_decl.value.is_constant()) {
var ctt = new TreeTransformer(function(node) {
- if (node === ref) {
- var parent = ctt.parent();
- if (!(parent instanceof AST_ForIn && parent.init === node)) {
- return replace_var(node, parent, true);
- }
+ if (node === ref
+ && !ctt.find_parent(AST_ForIn)) {
+ return replace_var(node, ctt.parent(), true);
}
});
stat.transform(ctt);