Suggestion: Infix operators/functions
Mike Samuel
mikesamuel at gmail.com
Fri Feb 2 16:03:42 UTC 2018
On Fri, Feb 2, 2018 at 10:58 AM, Mike Samuel <mikesamuel at 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
Insertion
<http://www.ecma-international.org/ecma-262/6.0/#sec-automatic-semicolon-insertion>
:
"""
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
LineTerminator.
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180202/50845390/attachment-0001.html>
More information about the es-discuss
mailing list