Index: src/preparser.cc |
diff --git a/src/preparser.cc b/src/preparser.cc |
index 398f32744cb61ff6c5e5af317d22b8d117f37b9f..8a621b4ff2455b1888e7bbd06ac2bc15258a9063 100644 |
--- a/src/preparser.cc |
+++ b/src/preparser.cc |
@@ -146,8 +146,8 @@ PreParserExpression PreParserTraits::ParseFunctionLiteral( |
} |
-PreParserExpression PreParserTraits::ParsePostfixExpression(bool* ok) { |
- return pre_parser_->ParsePostfixExpression(ok); |
+PreParserExpression PreParserTraits::ParseUnaryExpression(bool* ok) { |
+ return pre_parser_->ParseUnaryExpression(ok); |
} |
@@ -842,6 +842,37 @@ PreParser::Statement PreParser::ParseDebuggerStatement(bool* ok) { |
#undef DUMMY |
+PreParser::Expression PreParser::ParseUnaryExpression(bool* ok) { |
+ // UnaryExpression :: |
+ // PostfixExpression |
+ // 'delete' UnaryExpression |
+ // 'void' UnaryExpression |
+ // 'typeof' UnaryExpression |
+ // '++' UnaryExpression |
+ // '--' UnaryExpression |
+ // '+' UnaryExpression |
+ // '-' UnaryExpression |
+ // '~' UnaryExpression |
+ // '!' UnaryExpression |
+ |
+ Token::Value op = peek(); |
+ if (Token::IsUnaryOp(op)) { |
+ op = Next(); |
+ ParseUnaryExpression(ok); |
+ return Expression::Default(); |
+ } else if (Token::IsCountOp(op)) { |
+ op = Next(); |
+ Expression expression = ParseUnaryExpression(CHECK_OK); |
+ if (strict_mode() == STRICT) { |
+ CheckStrictModeLValue(expression, CHECK_OK); |
+ } |
+ return Expression::Default(); |
+ } else { |
+ return ParsePostfixExpression(ok); |
+ } |
+} |
+ |
+ |
PreParser::Expression PreParser::ParsePostfixExpression(bool* ok) { |
// PostfixExpression :: |
// LeftHandSideExpression ('++' | '--')? |