Parent: #899
Problem
Seven direct bare exits in binding-pattern and variable-declaration parsing, plus the adjacent generic destructuring-initializer expectation, discard the binding token, declaration kind, variable name, or required initializer context.
Executed on current main (14b4273), eleven standard var/let/const eval probes differ from raw JavaScriptCore 625.1.22:
- invalid simple or nested binding tokens lose
Expected a parameter pattern or a ')' in parameter list. - forbidden
varand lexical names lose their declaration-kind-specific message let letloses its LexicalDeclaration restriction- a missing simple
constinitializer loses the declared name - a missing destructuring initializer loses
Expected an initializer in destructuring variable declaration. - an object-rest
varbinding is mislabeled as lexical
Two explicit-resource-management forms have no compatible JSC oracle. Node 24.18 confirms that a using destructuring binding is invalid and that a simple using declaration requires an initializer; these forms will retain exact offsets and Node-shaped grammar context without a JSC parity claim.
Malformed for-in/of bindings are separately scoped because tryForTarget currently treats target failures as speculative and rewinds them.
Implementation
- Carry a declaration-kind-specific forbidden-binding reason through nested binding targets.
- Retain invalid binding tokens and simple declaration tokens.
- Retain the variable name for missing
constinitializers. - Give destructuring declarations an initializer-specific expectation.
- Structure the two
usingproposal rejections without changing accepted syntax. - Add no allocation or source rescan to successful declaration parsing.
Verification
- Pin reason, message, and byte offset for all eleven JSC cases and two Node-validated
usingcases. - Add a focused production eval case for every message family.
- Compare exact-parent variable-statement, lexical-declaration, destructuring-binding, and explicit-resource-management test262 subtrees with nonzero denominators and report flips.