From bfb4b3572217e56d3b6a9087c1879f98cc28a5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 22 Dec 2023 22:37:44 +0100 Subject: [PATCH] Fix: 'for of' expression cannot start with 'async' Ref: https://github.com/bellard/quickjs/commit/7cefa7b121c8a800969672853b035278ebd6b24c --- quickjs.c | 2 ++ test262_errors.txt | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quickjs.c b/quickjs.c index 1e5dd63..bcf6f7d 100644 --- a/quickjs.c +++ b/quickjs.c @@ -24217,6 +24217,8 @@ 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/test262_errors.txt b/test262_errors.txt index 406b787..a358a7b 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -28,5 +28,3 @@ test262/test/language/expressions/generators/static-init-await-binding.js:16: st 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:16: 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.