On Fri, Feb 2, 2018 at 10:58 AM, Mike Samuel <mikesam...@gmail.com> wrote:

> How would this affect ASI?
>     a  // no semicolon inserted since '+' is an infix operator
>     +b
>     a  // semicolon inserted since '!' is not an infix operator
>     !b
> but what about
>     function '!'(a, b) { ... }
>     // now '!' is both an infix and a prefix operator
>     a  // is a semicolon inserted?
>     !b

The relevant portion of the spec is 11.9.1 Rules of Automatic Semicolon
   There are three basic rules of semicolon insertion:
   1. When, as a Script or Module is parsed from left to right, a token
(called the
       offending token) is encountered that *is not allowed by any
production* of the
      grammar, then a semicolon is automatically inserted before the
offending token
      if one or more of the following conditions is true:

      *  The offending token is separated from the previous token by at
least one

es-discuss mailing list

Reply via email to