[parse tasks] Fix arrow function parameters handling.
Formal parameters of an arrow function are parsed even if the function itself is preparsed. It is because we don't know if it is an arrow function parameter list or just comma separated expression list. When we parse: (a, b = (function c() { return a; })()) call to function c may be just part of an assignment in an expression list, but if it's followed by: => { return b; } It is an arrow function and the call to c is a default parameter. Before we see the arrow we might have already created a parse task to parse function c. BUG=v8:6093 Change-Id: I59a59acfdbbfd808dab1518060748be2addcd54a Reviewed-on: https://chromium-review.googlesource.com/493347 Commit-Queue: Wiktor Garbacz <wiktorg@google.com> Reviewed-by: Marja Hölttä <marja@chromium.org> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/master@{#45132}
This commit is contained in:
parent
fbd7754947
commit
9a572e1d5f
@ -5219,6 +5219,12 @@ void Parser::StitchAst(ParseInfo* top_level_parse_info, Isolate* isolate) {
|
||||
}
|
||||
}
|
||||
FunctionLiteral* literal = *it;
|
||||
// FIXME(wiktorg) better handling of default params for arrow functions
|
||||
Scope* outer_scope = literal->scope()->outer_scope();
|
||||
if (outer_scope->is_declaration_scope() &&
|
||||
outer_scope->AsDeclarationScope()->was_lazily_parsed()) {
|
||||
continue;
|
||||
}
|
||||
// TODO(wiktorg) in the future internalize somewhere else (stitching may be
|
||||
// done on streamer thread)
|
||||
result->ast_value_factory()->Internalize(isolate);
|
||||
|
@ -45,3 +45,11 @@ var result = (function recursive(a=0) {
|
||||
})();
|
||||
|
||||
assertEquals(result, 42);
|
||||
|
||||
var a = 42;
|
||||
var b;
|
||||
var c = (a, b = (function z(){ return a+1; })());
|
||||
assertEquals(b, 43);
|
||||
assertEquals(c, 43);
|
||||
var c = (a, b = (function z(){ return a+1; })()) => { return b; };
|
||||
assertEquals(c(314), 315);
|
||||
|
Loading…
Reference in New Issue
Block a user