]> git.kaiwu.me - quickjs.git/commitdiff
fixed parsing of function definition
authorFabrice Bellard <fabrice@bellard.org>
Sat, 24 May 2025 10:47:35 +0000 (12:47 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 24 May 2025 10:47:35 +0000 (12:47 +0200)
quickjs.c
test262_errors.txt

index b9c015223aec49ad34155c33bcd1b585c0767dcd..ac4f2aaec1c45b59d56864d6f3262f547d3cad04 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -35353,7 +35353,7 @@ static __exception int js_parse_function_decl2(JSParseState *s,
     push_scope(s);  /* enter body scope */
     fd->body_scope = fd->scope_level;
 
-    if (s->token.val == TOK_ARROW) {
+    if (s->token.val == TOK_ARROW && func_type == JS_PARSE_FUNC_ARROW) {
         if (next_token(s))
             goto fail;
 
index dbbcac2e3abedbde5903cde47d55977a48f1c5f5..6cac22d3d78003160c7763d4a9e5df845e30698b 100644 (file)
@@ -28,7 +28,6 @@ test262/test/staging/sm/async-functions/await-error.js:12: Test262Error: Expecte
 test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:33: Error: Assertion failed: expected exception SyntaxError, no exception thrown - AsyncFunction:(a = (b = await/r/g) => {}) => {}
 test262/test/staging/sm/class/boundFunctionSubclassing.js:12: Test262Error: Expected SameValue(«false», «true») to be true
 test262/test/staging/sm/class/compPropNames.js:26: Error: Expected syntax error: ({[1, 2]: 3})
-test262/test/staging/sm/class/methDefn.js:26: Error: Expected syntax error: b = {a() => 0}
 test262/test/staging/sm/class/strictExecution.js:32: Error: Assertion failed: expected exception TypeError, no exception thrown
 test262/test/staging/sm/class/superPropOrdering.js:83: Error: Assertion failed: expected exception TypeError, no exception thrown
 test262/test/staging/sm/expressions/optional-chain.js:25: Error: Assertion failed: expected exception SyntaxError, no exception thrown