fixed parsing of function definition

This commit is contained in:
Fabrice Bellard 2025-05-24 12:47:35 +02:00
parent 3dc7ef1f7f
commit 02a2643142
2 changed files with 1 additions and 2 deletions

View File

@ -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;

View 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