This look ahead looks scary.

I don't think you need it for rest params in arrow functions. The reason is that we can validate the paren expression when we close the `)`. If we see a `=>` we go back and check that there are no spread expressions in non tail position. If we don't see a `=>` we check that there are no spread expressions. We can also
keep track of the first spread location and other data we need so we don't
actually have to go back over the ast.

The only complicated thing about this is the order we report errors (but I think
we might be getting this wrong in other places too):

(...x, &y)

should probably report `...` before `&`.




https://codereview.chromium.org/987083003/diff/20001/src/ast.h
File src/ast.h (right):

https://codereview.chromium.org/987083003/diff/20001/src/ast.h#newcode95
src/ast.h:95: V(SpreadOperation)            \
Maybe just Spread?

https://codereview.chromium.org/987083003/diff/20001/src/full-codegen.cc
File src/full-codegen.cc (right):

https://codereview.chromium.org/987083003/diff/20001/src/full-codegen.cc#newcode292
src/full-codegen.cc:292: UNREACHABLE();
This does not seem right. Shouldn't this be:

Visit(expr->expression());

... or maybe I am thinking to far ahead when we have array and call
spread.

https://codereview.chromium.org/987083003/diff/20001/src/parser.cc
File src/parser.cc (right):

https://codereview.chromium.org/987083003/diff/20001/src/parser.cc#newcode3556
src/parser.cc:3556: bool is_rest = false;
Maybe this should go after the IsVariableProxy check since the comment
above is about that.

Or at least update the comment.

https://codereview.chromium.org/987083003/diff/20001/src/preparser.h
File src/preparser.h (right):

https://codereview.chromium.org/987083003/diff/20001/src/preparser.h#newcode1894
src/preparser.h:1894: //   ... Identifier ')' '=>'
Why ')' '=>'?

https://codereview.chromium.org/987083003/diff/20001/src/preparser.h#newcode1968
src/preparser.h:1968: int x = 5;
On 2015/03/10 09:11:19, marja wrote:
?

Looks like debug code... remove?

https://codereview.chromium.org/987083003/diff/20001/src/preparser.h#newcode2019
src/preparser.h:2019: &is_strict_reserved_name, CHECK_OK);
I don't see where is_strict_reserved_name is being checked?
ArrowFormalParameters are always strict.

https://codereview.chromium.org/987083003/diff/20001/src/preparser.h#newcode2031
src/preparser.h:2031:
ReportUnexpectedTokenAt(scanner_->peek_location(1), peek(1));
Another option here is to report the invalid `...`

https://codereview.chromium.org/987083003/

--
--
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