Parent: #899
Problem
Arrow parameter cover grammar still loses JavaScriptCore's token-specific diagnostics when yield or await is active in the surrounding grammar. This is a separate parser path from #965's function parameter early errors.
Executed against JavaScriptCore 625.1.22:
| shape | JavaScriptCore |
|---|---|
async (a = await) => 0 | Cannot use 'await' within a parameter default expression. |
async (a = await x) => 0 | Unexpected identifier 'x'. Expected ')' to end an argument list. |
async ([a = await 1]) => 0 | Unexpected number '1'. Expected either a closing ']' or a ',' following an array element. |
async ({a = await 1}) => 0 | Unexpected token '='. Expected a ':' following the property name 'a'. |
function* outer(){ (a = yield) => 0; } | Unexpected keyword 'yield'. Cannot use yield expression out of generator. |
function* outer(){ (a = yield 1) => 0; } | Unexpected token '=>' |
function* outer(){ ([a = yield 1]) => 0; } | Unexpected number '1'. Expected either a closing ']' or a ',' following an element destructuring pattern. |
function* outer(){ ({a = yield 1}) => 0; } | Unexpected token '='. Expected a ':' following the property name 'a'. |
async function outer(){ (a = await 1) => 0; } | Unexpected token '=>' |
zig-js rejects all of these, but most still surface UnexpectedToken and end-of-cover position. Async-generator and async-arrow combinations follow the same families. Defaults containing a nested ordinary function remain valid in both engines.
Constraint
Do not reuse #965's function-parameter messages wholesale. The cover grammar chooses different offending tokens based on scalar, array, and object forms. Preserve those grammar distinctions and keep the existing one-pass parenthesis index and accepted-program allocation behavior.
Verification
- exact JSC differential across scalar, array, object, async-generator, and nested-boundary forms;
- focused evaluator matrix for
.message; - standalone parser module;
- exact-parent test262 comparison across arrow, async-arrow, generator, and async-function subtrees.