ladybird/Libraries/LibJS/Tests/syntax
Aliaksandr Kalenik dcfc515cd0
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
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