]> git.kaiwu.me - quickjs.git/commitdiff
'for of' expression cannot start with 'async'
authorFabrice Bellard <fabrice@bellard.org>
Fri, 22 Dec 2023 10:05:18 +0000 (11:05 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Fri, 22 Dec 2023 10:05:18 +0000 (11:05 +0100)
quickjs.c
test262_errors.txt

index a01b5ccb7793c13dd3cd8cae7215b59cb1acddbd..c80a3005024d3b2e17e248b27d1f6a242772a97a 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -25787,6 +25787,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 == '{')
index 1e4ade1b0cfc8000dcffd2c10c5255d16a02c2c5..77ee6cca55dc1f9216058d738465b6da1073826d 100644 (file)
@@ -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.