reject invalid for await syntax (#4847)

This commit is contained in:
Alex Lam S.L
2021-04-07 15:37:15 +01:00
committed by GitHub
parent 73a564343b
commit a37ca558dd
3 changed files with 16 additions and 1 deletions

View File

@@ -1189,7 +1189,7 @@ function parse($TEXT, options) {
var await = is("name", "await") && next();
expect("(");
var init = null;
if (!is("punc", ";")) {
if (await || !is("punc", ";")) {
init = is("keyword", "const")
? (next(), const_(true))
: is("keyword", "let")