Let all early errors be SyntaxErrors

Replace all early ReferenceErrors with early SyntaxErrors.

The spec has been inconsistent with respect to the "early ReferenceError" notion: only update/assignment expressions (e.g. `0++`, `0 = 0`) throw early ReferenceErrors, while other invalid assignments like `[0] = []` and `for (0 of []) {}` throw early SyntaxErrors. Furthermore, this becomes an observable concern with eval. If eval throws a ReferenceError, the user has had no way to know whether the code was actually executed or simply parsed (short of matching on error message strings).

Documentation

Specification

Editor's draft

Status in Chromium

Blink>JavaScript>Language


In development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No public signals
  • No public signals
  • No public signals
  • No signals

Owners

Last updated on 2019-06-20