Disallow declaration statements in block-less context

Closes #202
This commit is contained in:
Marijn Haverbeke
2015-01-20 12:55:21 +01:00
parent 33a7c9fc24
commit 94b5efcd3e
2 changed files with 26 additions and 16 deletions

View File

@@ -14876,3 +14876,8 @@ test("`${/\d/.exec('1')[0]}`", {
}, {
ecmaVersion: 6
});
testFail("if (1) let x = 10;", "Unexpected token (1:7)", {ecmaVersion: 6});
testFail("for (;;) const x = 10;", "Unexpected token (1:9)", {ecmaVersion: 6});
testFail("while (1) function foo(){}", "Unexpected token (1:10)", {ecmaVersion: 6});
testFail("if (1) ; else class Cls {}", "Unexpected token (1:14)", {ecmaVersion: 6});