1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
ladybird/Libraries/LibJS/Tests/syntax
Aliaksandr Kalenik dcfc515cd0 LibJS: Fix arrow function parsing bug
In the following example:
```js
const f = (i) => ({
    obj: { a: { x: i }, b: { x: i } },
    g: () => {},
});
```

The body of function `f` is initially parsed as an arrow function. As a
result, what is actually an object expression is interpreted as a formal
parameter with a binding pattern. Since duplicate identifiers are not
allowed in this context (`i` in the example), the parser generates an
error, causing the entire script to fail parsing.

This change ignores the "Duplicate parameter names in bindings" error
during arrow function parameter parsing, allowing the parser to continue
and recognize the object expression of the outer arrow function with an
implicit return.

Fixes error on https://chat.openai.com/
2025-05-26 12:44:21 +03:00
..
async-await.js
async-generators.js
coalesce-logic-expression-mixing.js
destructuring-assignment.js
dynamic-import-usage.js
for-loop-invalid-in.js
function-hoisting.js
functions-in-tree-order-non-strict.js
functions-in-tree-order-strict.js
generators.js
if-statement-empty-completion.js
new-with-optional-chaining.js
numeric-separator.js
optional-chaining.js
return-object-with-duplicated-field-names-from-arrow-function.js LibJS: Fix arrow function parsing bug 2025-05-26 12:44:21 +03:00
slash-after-block.js
switch-as-statement.js
syntax-error-unary-expression-before-exponentiation.js