Replace all early ReferenceErrors with early SyntaxErrors.

Motivation

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).

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 signal
  • No signal
  • No signal
  • No signals

Owners

Last updated on 2021-07-25