On 2014/06/13 at 14:05:51, marja wrote:
On 2014/06/12 17:40:04, arv wrote:
> On 2014/06/12 at 07:25:16, marja wrote:
> > Code LGTM. Looks like a reasonable thing to do. There might be some
surprising
> breakage though, like, some scripts might have the wrong get/set
parameter
count
> inside lazy functions which were never executed. But I think this is
worth
> trying out nevertheless.
>
> Thanks. Can you land this for me?
>
> The following throws an error as expected:
>
> ```js
> var s = 'return /*' + Array(1e6).join(' ') + '*/ {get x(error) {}};';
> Function(s);
> ```
>
> Is this a valid way to test the preparser? (I got the idea from Andy's
CL at
> https://codereview.chromium.org/332443002)
>
> If not, then I need to investigate more time on how we do early syntax
errors
> for strict functions that have duplicate property names in object
literals.
No, afaics that doesn't invoke the PreParser.
PreParser is only invoked for parsing inside lazy functions, i.e.,
function top_level_func() {
// this is parsed with PreParser
...
}
under a bunch of conditions (laziness needs to be allowed, the code needs
to
be long enough). Especially, if the function is in parenthesis, it's not
lazy.
With your code snippet, we end up parsing this:
(function() { return /* ... */ { get x(error){}}; })
(You can verify this by putting source->Print(stderr); inside
Parser::ParseProgram().)
So it's not lazy, since the function is in parenthesis. (The relevant
thing to
check is is_lazily_parsed inside ParseFunctionLiteral.)
However, test-parsing.cc parses the same code with Parser and PreParser
and
tests that they produce the same errors, so I think this CL is good.
Thanks for explaining this. It is good to know that test-parsing.cc tests
both.
Hmm, duplicate property names in object literals in PreParser? Isn't that
taken care by ObjectLiteralChecker already?
My point was that I would have to look closer, looking at how the
ObjectLiteralChecker is invoked.
https://codereview.chromium.org/329413002/
--
--
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.