| Index: src/preparser.cc
|
| diff --git a/src/preparser.cc b/src/preparser.cc
|
| index 15fca26788d56ad5a970d17bcbb834b3d796f244..5a1e5422c9015f1032ffc1e4292146f1f867cf1a 100644
|
| --- a/src/preparser.cc
|
| +++ b/src/preparser.cc
|
| @@ -923,9 +923,11 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
|
| arity_restriction != FunctionLiteral::SETTER_ARITY);
|
| while (!done) {
|
| bool is_strict_reserved = false;
|
| + int rest_pos;
|
| is_rest = peek() == Token::ELLIPSIS && allow_harmony_rest_params();
|
| if (is_rest) {
|
| Consume(Token::ELLIPSIS);
|
| + rest_pos = position();
|
| }
|
|
|
| Identifier param_name =
|
| @@ -943,6 +945,19 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
|
| dupe_error_loc = scanner()->location();
|
| }
|
|
|
| + if (peek() == Token::ASSIGN) {
|
| + Consume(Token::ASSIGN);
|
| + static const bool accept_IN = true;
|
| + ExpressionT defaultValue = ParseAssignmentExpression(accept_IN, CHECK_OK);
|
| + if (is_rest) {
|
| + ReportMessageAt(Scanner::Location(rest_pos, scanner()->location().end_pos), "rest_param_default");
|
| + *ok = false;
|
| + return Expression::Default();
|
| + }
|
| + // Default value is not needed in pre-parser.
|
| + USE(defaultValue);
|
| + }
|
| +
|
| if (arity_restriction == FunctionLiteral::SETTER_ARITY) break;
|
| done = (peek() == Token::RPAREN);
|
| if (!done) {
|
|
|