| Index: src/preparser.cc
|
| diff --git a/src/preparser.cc b/src/preparser.cc
|
| index a02305ffd206bb0a0b5097e9961685cd52c7d5b2..20152caed6a8e4efc001ac5f58c46cfc47c59961 100644
|
| --- a/src/preparser.cc
|
| +++ b/src/preparser.cc
|
| @@ -929,9 +929,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 =
|
| @@ -952,6 +954,36 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
|
| dupe_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 (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) {
|
|
|