commit b51a9bfeed815a51d8d20835b2c545e5512af0a3
parent 13a0d8e0dc60d796e41db578e2f7fcfe5d6911ff
Author: Fabrice Bellard <fabrice@bellard.org>
Date: Fri, 22 Dec 2023 11:05:18 +0100
'for of' expression cannot start with 'async'
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/quickjs/quickjs.c b/quickjs/quickjs.c
@@ -25974,6 +25974,9 @@ static __exception int js_parse_for_in_of(JSParseState *s, int label_name,
emit_atom(s, var_name);
emit_u16(s, fd->scope_level);
}
+ } else if (!is_async && token_is_pseudo_keyword(s, JS_ATOM_async) &&
+ peek_token(s, FALSE) == TOK_OF) {
+ return js_parse_error(s, "'for of' expression cannot start with 'async'");
} else {
int skip_bits;
if ((s->token.val == '[' || s->token.val == '{')
diff --git a/quickjs/test262_errors.txt b/quickjs/test262_errors.txt
@@ -18,5 +18,3 @@ test262/test/language/expressions/dynamic-import/usage-from-eval.js:26: strict m
test262/test/language/expressions/optional-chaining/optional-call-preserves-this.js:21: TypeError: cannot read property 'c' of undefined
test262/test/language/expressions/optional-chaining/optional-call-preserves-this.js:15: strict mode: TypeError: cannot read property '_b' of undefined
test262/test/language/global-code/script-decl-lex-var-declared-via-eval-sloppy.js:13: Test262Error: variable Expected a SyntaxError to be thrown but no exception was thrown at all
-test262/test/language/statements/for-of/head-lhs-async-invalid.js:14: unexpected error type: Test262: This statement should not be evaluated.
-test262/test/language/statements/for-of/head-lhs-async-invalid.js:14: strict mode: unexpected error type: Test262: This statement should not be evaluated.