https://codereview.chromium.org/1127063003/diff/60001/src/parser.cc
File src/parser.cc (right):

https://codereview.chromium.org/1127063003/diff/60001/src/parser.cc#newcode1153
src/parser.cc:1153: ParseFormalParameter(scope, &error_locs, nullptr,
nullptr, has_rest,
nit: would be easier to read with named variables for these nullptrs

https://codereview.chromium.org/1127063003/diff/60001/src/parser.cc#newcode3546
src/parser.cc:3546: // If hasParameterExpressions for the function is
true, each parameter is
has_initializers I guess?  I know hasParameterExpressions is the spec
language; is has_initializers the same?

https://codereview.chromium.org/1127063003/diff/60001/src/parser.cc#newcode3574
src/parser.cc:3574: DCHECK(ok);
Seems that Declare can only fail for a var redeclaration, which is
impossible here, OK.  Still, a comment would save the reader some time
:)

https://codereview.chromium.org/1127063003/diff/60001/src/preparser.h
File src/preparser.h (right):

https://codereview.chromium.org/1127063003/diff/60001/src/preparser.h#newcode3541
src/preparser.h:3541: DCHECK(scope_->is_function_scope());
On 2015/05/09 20:57:22, caitp wrote:
Apparently this is a problem for lazy-parsed arrow functions :( There
has got to
be a better way

So only lazy-parsed arrow functions will have a chance to have
initializer expressions AFAIU -- is that right?  I mean, otherwise we
don't know that it's an initializer and you haven't modified
ParseArrowFunctionFormalParameters to handle initializers.  That is
going to be horrific by the way -- you'll be lifting expressions parsed
in one function to another.  There's still some state being allocated in
the parser (literal counts, handler indices, expected property counts)
that will need to be rewritten for initializers lifted to inner
functions.  In my mind the right way to do that is to move to a
post-pass; for that reason it seems that optional argument initializers
are going to be quite a challenge.  Dunno.

So that said it should be impossible to get to a lazily parsed arrow
function with default initializers with the current code.  The preparser
should have already discounted the possibility of the "formals" of the
arrow function being valid.

https://codereview.chromium.org/1127063003/

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