diff options
Diffstat (limited to 'chromium/v8/src/parsing/parser.cc')
-rw-r--r-- | chromium/v8/src/parsing/parser.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/v8/src/parsing/parser.cc b/chromium/v8/src/parsing/parser.cc index b5241dd6768..cc6b6a260b2 100644 --- a/chromium/v8/src/parsing/parser.cc +++ b/chromium/v8/src/parsing/parser.cc @@ -880,6 +880,8 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, scope->set_start_position(info->start_position()); ExpressionClassifier formals_classifier(this); ParserFormalParameters formals(scope); + int rewritable_length = + function_state.destructuring_assignments_to_rewrite().length(); Checkpoint checkpoint(this); { // Parsing patterns as variable reference expression creates @@ -916,7 +918,8 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, // Pass `accept_IN=true` to ParseArrowFunctionLiteral --- This should // not be observable, or else the preparser would have failed. - Expression* expression = ParseArrowFunctionLiteral(true, formals, &ok); + Expression* expression = + ParseArrowFunctionLiteral(true, formals, rewritable_length, &ok); if (ok) { // Scanning must end at the same position that was recorded // previously. If not, parsing has been interrupted due to a stack @@ -929,6 +932,10 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, // must produce a FunctionLiteral. DCHECK(expression->IsFunctionLiteral()); result = expression->AsFunctionLiteral(); + // Rewrite destructuring assignments in the parameters. (The ones + // inside the function body are rewritten by + // ParseArrowFunctionLiteral.) + RewriteDestructuringAssignments(); } else { ok = false; } |