On 2015/03/10 19:29:44, marja wrote:
I'm confused! I always thought that the rule is "a semicolon is inserted
*only*
if it's a syntax error without the semicolon".

Is this no longer true? What's going on here? Is there an additional
restriction
that there cannot be a line feed between params and arrow, independent of ASI?

From
`https://people.mozilla.org/~jorendorff/es6-draft.html#sec-grammar-notation`

```
If the phrase “[no LineTerminator here]” appears in the right-hand side of a
production of the syntactic grammar, it indicates that the production is a
restricted production: it may not be used if a LineTerminator occurs in the
input stream at the indicated position. For example, the production:

ThrowStatement :
throw [no LineTerminator here] Expression ;
indicates that the production may not be used if a LineTerminator occurs in the
script between the throw token and the Expression.
```

Since the arrow function production requires that there is no line terminator before the `=>`, then we need to treat it as though there was a semicolon. `var
fn = (a)\n` would be perfectly valid in ES5, so it's still valid in ES6, but
there's a syntax error if the next statement starts with `=>`.

https://codereview.chromium.org/987203003/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to