fix for-of loop with const iterator (#1899)

This commit is contained in:
kzc
2017-05-09 23:36:03 -04:00
committed by Alex Lam S.L
parent 6ddb5bd94d
commit 9d59c693c2
2 changed files with 35 additions and 3 deletions

View File

@@ -392,3 +392,35 @@ format_methods: {
"}",
]
}
issue_1898: {
options = {
}
mangle = {
}
input: {
class Foo {
bar() {
for (const x of [ 6, 5 ]) {
for (let y of [ 4, 3 ]) {
for (var z of [ 2, 1 ]) {
console.log(x, y, z);
}
}
}
}
}
new Foo().bar();
}
expect: {
class Foo {
bar() {
for (const n of [ 6, 5 ])
for (let r of [ 4, 3 ])
for (var o of [ 2, 1 ])
console.log(n, r, o);
}
}
new Foo().bar();
}
}