Parent: #899
Problem
Five direct bare exits in parseFor discard the token and grammar rule after the parser has already distinguished:
- the forbidden bare
async oflookahead inin a for-await headusing/await usingin a for-in head- an initializer in a sloppy
varfor-of head - a classic semicolon head after
for await
Executed on current main (78d0d08), eight representative eval probes all produce eval: UnexpectedToken at .... Raw JavaScriptCore 625.1.22 instead reports:
Unexpected identifier 'of'forfor (async of [])Unexpected keyword 'in'. Expected 'of' in for-await syntax.Unexpected identifier 'x'. Expected either 'in' or 'of' in enumeration syntax.for plain, await-using, and combined for-await using formsCannot assign to the loop variable inside a for-of loop header.Unexpected token ';'. Unexpected a ';' in for-await-of header.for empty and declared classic heads
Implementation
- Retain the already-read iteration keyword, using-binding token index, initializer offset, or cached top-level semicolon at each rejection.
- Preserve JavaScriptCore's using-head diagnostic when a using declaration is also nested in
for await. - Match raw JavaScriptCore prose while preserving compact
ParseErrorcategories. - Add no allocation or source rescan to the successful for-loop path.
Verification
- Pin reason, message, and byte offset for every site and the overlapping for-await/using case.
- Add a focused production eval case for all message families.
- Compare exact-parent for-in/of/await and explicit-resource-management test262 subtrees with nonzero denominators and report flips.