RFE: Allow newline when returning an anonymous object

Brendan Eich brendan at mozilla.org
Wed May 28 12:06:46 PDT 2014


Tab Atkins Jr. wrote:
> Remember the general rule: semicolons are always automatically
> inserted at the end of lines*unless*  doing so would cause a syntax
> error on that line or the next.

No, this is not accurate. Consider

   A
   (B);

Inserting a semicolon as you wrote:

   A;
   (B):

does not make a syntax error, but it is not what ASI does, and doing so 
would break valid JS programs.

ASI is an error correction procedure plus those "restricted productions" 
(including the return statement's production).

/be


More information about the es-discuss mailing list