| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index 068b677094fdbac0b9f07c62119590d4ef240540..a9837a7d5f9b5517659d5f16b305f30c1fb7f4a8 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -1576,7 +1576,7 @@ Statement* Parser::ParseExportDefault(bool* ok) {
|
| int pos = peek_position();
|
| ExpressionClassifier classifier;
|
| Expression* expr = ParseAssignmentExpression(true, &classifier, CHECK_OK);
|
| - ValidateExpression(&classifier, CHECK_OK);
|
| + expr = ParserTraits::RewriteNonPattern(expr, &classifier, CHECK_OK);
|
|
|
| ExpectSemicolon(CHECK_OK);
|
| result = factory()->NewExpressionStatement(expr, pos);
|
| @@ -2395,7 +2395,7 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| value = ParseAssignmentExpression(var_context != kForStatement,
|
| &classifier, ok);
|
| if (!*ok) return;
|
| - ValidateExpression(&classifier, ok);
|
| + value = ParserTraits::RewriteNonPattern(value, &classifier, ok);
|
| if (!*ok) return;
|
| variable_loc.end_pos = scanner()->location().end_pos;
|
|
|
| @@ -2506,7 +2506,7 @@ Statement* Parser::ParseExpressionOrLabelledStatement(
|
| } else {
|
| expr = ParseStrongSuperCallExpression(&classifier, CHECK_OK);
|
| }
|
| - ValidateExpression(&classifier, CHECK_OK);
|
| + expr = ParserTraits::RewriteNonPattern(expr, &classifier, CHECK_OK);
|
| switch (peek()) {
|
| case Token::SEMICOLON:
|
| Consume(Token::SEMICOLON);
|
| @@ -3727,7 +3727,8 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
|
| if (is_destructuring) {
|
| ValidateAssignmentPattern(&classifier, CHECK_OK);
|
| } else {
|
| - ValidateExpression(&classifier, CHECK_OK);
|
| + expression =
|
| + ParserTraits::RewriteNonPattern(expression, &classifier, CHECK_OK);
|
| }
|
|
|
| if (is_for_each) {
|
| @@ -4776,8 +4777,8 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
|
| ObjectLiteral::Property* property = ParsePropertyDefinition(
|
| &checker, in_class, has_extends, is_static, &is_computed_name,
|
| &has_seen_constructor, &classifier, &name, CHECK_OK);
|
| - property = ParserTraits::RewriteObjectLiteralProperty(property, &classifier,
|
| - CHECK_OK);
|
| + property = ParserTraits::RewriteNonPatternObjectLiteralProperty(
|
| + property, &classifier, CHECK_OK);
|
|
|
| if (has_seen_constructor && constructor == NULL) {
|
| constructor = GetPropertyValue(property)->AsFunctionLiteral();
|
| @@ -4828,7 +4829,7 @@ Expression* Parser::ParseV8Intrinsic(bool* ok) {
|
| ExpressionClassifier classifier;
|
| ZoneList<Expression*>* args =
|
| ParseArguments(&spread_pos, &classifier, CHECK_OK);
|
| - ValidateExpression(&classifier, CHECK_OK);
|
| + args = RewriteNonPatternArguments(args, &classifier, CHECK_OK);
|
|
|
| DCHECK(!spread_pos.IsValid());
|
|
|
| @@ -5398,10 +5399,18 @@ Expression* ParserTraits::RewriteNonPattern(
|
| }
|
|
|
|
|
| -ObjectLiteralProperty* ParserTraits::RewriteObjectLiteralProperty(
|
| +ZoneList<Expression*>* ParserTraits::RewriteNonPatternArguments(
|
| + ZoneList<Expression*>* args, const ExpressionClassifier* classifier,
|
| + bool* ok) {
|
| + return parser_->RewriteNonPatternArguments(args, classifier, ok);
|
| +}
|
| +
|
| +
|
| +ObjectLiteralProperty* ParserTraits::RewriteNonPatternObjectLiteralProperty(
|
| ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
|
| bool* ok) {
|
| - return parser_->RewriteObjectLiteralProperty(property, classifier, ok);
|
| + return parser_->RewriteNonPatternObjectLiteralProperty(property, classifier,
|
| + ok);
|
| }
|
|
|
|
|
| @@ -5414,7 +5423,16 @@ Expression* Parser::RewriteNonPattern(Expression* expr,
|
| }
|
|
|
|
|
| -ObjectLiteralProperty* Parser::RewriteObjectLiteralProperty(
|
| +ZoneList<Expression*>* Parser::RewriteNonPatternArguments(
|
| + ZoneList<Expression*>* args, const ExpressionClassifier* classifier,
|
| + bool* ok) {
|
| + // For the time being, this does no rewriting at all.
|
| + ValidateExpression(classifier, ok);
|
| + return args;
|
| +}
|
| +
|
| +
|
| +ObjectLiteralProperty* Parser::RewriteNonPatternObjectLiteralProperty(
|
| ObjectLiteralProperty* property, const ExpressionClassifier* classifier,
|
| bool* ok) {
|
| if (property != nullptr) {
|
|
|