Parent: #899. Related: #912, #496.
Verified remaining gap
The saved parent/candidate gate for #913 retained 12/14 exact diagnostic matches. The two remaining cases are global template substitutions containing new.target:
`x${new.target}`
String.raw`x${new.target}`
System JavaScriptCore reports SyntaxError: new.target is only valid inside functions or static blocks.. zig-js reports the internal eval: UnexpectedToken at ... form. Both reject the invalid programs; this is a diagnostic/provenance gap, not evidence of an acceptance failure.
Root cause
Parser.parseNew already records new_start_token, validates the contextual target identifier, and checks new_target_depth. The depth-zero branch still returns bare ParseError.UnexpectedToken, without a DiagnosticReason or offending offset. The existing failWithReasonAt path can retain the reason and original new position, including through the template-subparser offset translation. Direct eval already seeds new_target_depth from its actual enclosing context, and #912 preserves that context inside substitutions.
Required fix and gates
- Record a dedicated diagnostic reason only at the existing depth-zero rejection; preserve the ParseError category and all syntactic-context/admission rules.
- Keep invalid/escaped
new.<identifier> diagnostics separate; do not infer the reason by scanning source text at the JS boundary.
- Verify direct and indirect eval, top-level arrows, valid enclosing functions/methods/static blocks, and nested tagged/untagged CRLF substitutions. Cover exact message, original byte/line/column metadata, and prevention of preceding side effects for early errors.
- Exercise both tree-walker and required-bytecode callers and relevant exact-parent test262 groups. Do not claim behavioral flips or full diagnostic completeness without measuring them.
This is a next frontend batch, not a claim that the implementation or validation has already landed. #914's provenance tooling and #913's performance publication remain in progress.
Parent: #899. Related: #912, #496.
Verified remaining gap
The saved parent/candidate gate for #913 retained 12/14 exact diagnostic matches. The two remaining cases are global template substitutions containing
new.target:`x${new.target}`String.raw`x${new.target}`System JavaScriptCore reports
SyntaxError: new.target is only valid inside functions or static blocks.. zig-js reports the internaleval: UnexpectedToken at ...form. Both reject the invalid programs; this is a diagnostic/provenance gap, not evidence of an acceptance failure.Root cause
Parser.parseNewalready recordsnew_start_token, validates the contextualtargetidentifier, and checksnew_target_depth. The depth-zero branch still returns bareParseError.UnexpectedToken, without aDiagnosticReasonor offending offset. The existingfailWithReasonAtpath can retain the reason and originalnewposition, including through the template-subparser offset translation. Direct eval already seedsnew_target_depthfrom its actual enclosing context, and #912 preserves that context inside substitutions.Required fix and gates
new.<identifier>diagnostics separate; do not infer the reason by scanning source text at the JS boundary.This is a next frontend batch, not a claim that the implementation or validation has already landed. #914's provenance tooling and #913's performance publication remain in progress.