| Index: src/parsing/parser-base.h
|
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
|
| index eade9a7402a4b7200e286d8b1f9067bbe6a88e5e..73e6151ff9ef4596c5ad2e8adcd620ba1e10ddf1 100644
|
| --- a/src/parsing/parser-base.h
|
| +++ b/src/parsing/parser-base.h
|
| @@ -2609,6 +2609,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);
|
| @@ -2632,6 +2633,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++;
|
| @@ -2667,7 +2669,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);
|
| + }
|
| }
|
| }
|
|
|
| @@ -3209,7 +3215,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);
|
| }
|
|
|