Commit graph

3 commits

Author SHA1 Message Date
Andreas Kling
e0ee0990cf LibJS: Preserve no-In context in arrow bodies
ArrowFunction carries the surrounding In grammar parameter into its
ConciseBody. The parser recognized arrows in for-loop init expressions,
but parsed expression bodies with In always enabled, so
`for (x => 0 in 1;;)` was accepted as a normal for loop.

Thread the existing forbidden-token state through arrow parsing so the
body leaves `in` for the for-head parser. That parser then rejects the
arrow as an invalid for-in left-hand side. Add coverage in the for-loop
no-In syntax test.
2026-05-22 01:56:57 +02:00
Andreas Kling
6d36517042 LibJS: Infer names for default parameter functions
SingleNameBinding default initializers use NamedEvaluation when the
argument value is undefined and the initializer is an anonymous function
or class definition.

Set the pending inferred name while evaluating default initializers for
identifier parameters, and add coverage for function, generator, async,
arrow, and class expressions.
2026-05-22 01:56:57 +02:00
Jelle Raaijmakers
e3faa9b5ad LibJS: Move tests to /Tests/LibJS 2026-01-22 07:46:48 -05:00
Renamed from Libraries/LibJS/Tests/functions/function-default-parameters.js (Browse further)