On 2015/06/19 13:55:49, rossberg wrote:
On 2015/06/19 13:45:33, wingo wrote:
> On 2015/06/19 13:40:40, rossberg wrote:
> > https://codereview.chromium.org/1191303002/diff/20001/src/messages.h
> > File src/messages.h (right):
> >
> >
>

https://codereview.chromium.org/1191303002/diff/20001/src/messages.h#newcode327
> > src/messages.h:327: "Expected () to start arrow function, but got '%'
instead
> of
> > '=>'")        \
> > Hm, isn't this also produced for (...x) and their ilk now? The message
might
> > actually increase confusion in that case.
>
> Yes.  It's two cases: () and (...x), but no other ilk :)

Wouldn't it also include (...x, y) or (x, ...y) or any generalisation of
those?

Not for (...x, y) because the (... case reads an identifier and then does:

        if (peek() == Token::COMMA) {
          ReportMessageAt(scanner()->peek_location(),
                          MessageTemplate::kParamAfterRest);
          *ok = false;
          return this->EmptyExpression();
        }

and then Expect()'s an ).

Not for (x, ...y) because that only passes through to ParseArrowFunctionLiteral
after it has seen the =>.

Anyway updated the patch for ();. It's the one I think that JS developers will run into in practice, and for which the error message is most confusing. The ... gives you a visual hint that you've just read formal parameters and now will
be reading an arrow, whereas () is used often in other places (most notably
function calls), and getting "unexpected token: ;" in respose to "return();"
seems weird to me.  Maybe that's just me though :)  Your call, please let me
know.

https://codereview.chromium.org/1191303002/

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to