Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/preparser.cc

Issue 203413009: Revert "Move ParseUnaryExpression into ParserBase and add tests." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ('++' | '--')?
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698