| Index: src/parsing/parser-base.h
|
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
|
| index d8705a654fd535d95fbe5fdcea017852e9241f40..72d7bc0901afbf573731ceecb15ef8c485e9cb7e 100644
|
| --- a/src/parsing/parser-base.h
|
| +++ b/src/parsing/parser-base.h
|
| @@ -2580,6 +2580,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
|
| bool done = (peek() == Token::RPAREN);
|
| bool was_unspread = false;
|
| int unspread_sequences_count = 0;
|
| + int spread_count = 0;
|
| while (!done) {
|
| int start_pos = peek_position();
|
| bool is_spread = Check(Token::ELLIPSIS);
|
| @@ -2603,6 +2604,7 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
|
| // are not prefixed with a spread '...' operator.
|
| if (is_spread) {
|
| was_unspread = false;
|
| + spread_count++;
|
| } else if (!was_unspread) {
|
| was_unspread = true;
|
| unspread_sequences_count++;
|
| @@ -2638,7 +2640,11 @@ typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
|
| // Unspread parameter sequences are translated into array literals in the
|
| // parser. Ensure that the number of materialized literals matches between
|
| // the parser and preparser
|
| - impl()->MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
|
| + if (was_unspread || spread_count > 1) {
|
| + // There was more than one spread, or the spread was not the final
|
| + // argument, so the parser will materialize literals.
|
| + impl()->MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
|
| + }
|
| }
|
| }
|
|
|
| @@ -3180,7 +3186,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) {
|
|
|
| bool is_super_call = result->IsSuperCallReference();
|
| if (spread_pos.IsValid()) {
|
| - result = impl()->SpreadCall(result, args, pos);
|
| + result = impl()->SpreadCall(result, args, pos, is_possibly_eval);
|
| } else {
|
| result = factory()->NewCall(result, args, pos, is_possibly_eval);
|
| }
|
|
|