fix unused on labeled for-loop (#1831)

fixes #1830
This commit is contained in:
Alex Lam S.L
2017-04-20 04:18:38 +08:00
committed by alexlamsl
parent 6ad823d1e8
commit d0faa471db
2 changed files with 55 additions and 14 deletions

View File

@@ -1029,3 +1029,38 @@ delete_assign_2: {
}
expect_stdout: true
}
issue_1830_1: {
options = {
unused: true,
}
input: {
!function() {
L: for (var b = console.log(1); !1;) continue L;
}();
}
expect: {
!function() {
L: for (console.log(1); !1;) continue L;
}();
}
expect_stdout: "1"
}
issue_1830_2: {
options = {
unused: true,
}
input: {
!function() {
L: for (var a = 1, b = console.log(a); --a;) continue L;
}();
}
expect: {
!function() {
var a = 1;
L: for (console.log(a); --a;) continue L;
}();
}
expect_stdout: "1"
}