| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index fb52eef56382155d70889fa53efcc74ba8f5a700..937ee544771f9dd9bd47e9d7196c62ea947c97c4 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -1611,7 +1611,10 @@ Statement* Parser::ParseExportDefault(bool* ok) {
|
|
|
| default: {
|
| int pos = peek_position();
|
| - Expression* expr = ParseAssignmentExpression(true, CHECK_OK);
|
| + ExpressionClassifier classifier;
|
| + Expression* expr = ParseAssignmentExpression(true, &classifier, CHECK_OK);
|
| + // TODO(dslomov): report error if not a valid expression.
|
| +
|
| ExpectSemicolon(CHECK_OK);
|
| result = factory()->NewExpressionStatement(expr, pos);
|
| break;
|
| @@ -2425,7 +2428,10 @@ Block* Parser::ParseVariableDeclarations(
|
| (mode == CONST && !is_for_iteration_variable)) {
|
| Expect(Token::ASSIGN, CHECK_OK);
|
| pos = position();
|
| - value = ParseAssignmentExpression(var_context != kForStatement, CHECK_OK);
|
| + ExpressionClassifier classifier;
|
| + value = ParseAssignmentExpression(var_context != kForStatement,
|
| + &classifier, CHECK_OK);
|
| + // TODO(dslomov): check that expression is valid.
|
| variable_loc.end_pos = scanner()->location().end_pos;
|
|
|
| if (first_initializer_loc && !first_initializer_loc->IsValid()) {
|
| @@ -4337,7 +4343,9 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
|
| Expression* extends = NULL;
|
| if (Check(Token::EXTENDS)) {
|
| block_scope->set_start_position(scanner()->location().end_pos);
|
| - extends = ParseLeftHandSideExpression(CHECK_OK);
|
| + ExpressionClassifier classifier;
|
| + extends = ParseLeftHandSideExpression(&classifier, CHECK_OK);
|
| + // TODO(dslomov): report error if not a valid expression.
|
| } else {
|
| block_scope->set_start_position(scanner()->location().end_pos);
|
| }
|
| @@ -4358,9 +4366,11 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
|
| const bool is_static = false;
|
| bool is_computed_name = false; // Classes do not care about computed
|
| // property names here.
|
| + ExpressionClassifier classifier;
|
| ObjectLiteral::Property* property = ParsePropertyDefinition(
|
| &checker, in_class, has_extends, is_static, &is_computed_name,
|
| - &has_seen_constructor, CHECK_OK);
|
| + &has_seen_constructor, &classifier, CHECK_OK);
|
| + // TODO(dslomov): report error if not a valid expression.
|
|
|
| if (has_seen_constructor && constructor == NULL) {
|
| constructor = GetPropertyValue(property)->AsFunctionLiteral();
|
| @@ -4409,7 +4419,10 @@ Expression* Parser::ParseV8Intrinsic(bool* ok) {
|
| const AstRawString* name = ParseIdentifier(kAllowRestrictedIdentifiers,
|
| CHECK_OK);
|
| Scanner::Location spread_pos;
|
| - ZoneList<Expression*>* args = ParseArguments(&spread_pos, CHECK_OK);
|
| + ExpressionClassifier classifier;
|
| + ZoneList<Expression*>* args =
|
| + ParseArguments(&spread_pos, &classifier, CHECK_OK);
|
| + // TODO(dslomov): report error if not a valid expression.
|
|
|
| DCHECK(!spread_pos.IsValid());
|
|
|
|
|