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

Unified Diff: src/preparser.h

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/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 7048c161e1282878714f0e439e6c00be058505d5..a060c03d171fce32e434ddc0ee8a3ce17dfe7641 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -394,7 +394,6 @@ class ParserBase : public Traits {
ExpressionT ParseYieldExpression(bool* ok);
ExpressionT ParseConditionalExpression(bool accept_IN, bool* ok);
ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool* ok);
- ExpressionT ParseUnaryExpression(bool* ok);
// Used to detect duplicates in object literals. Each of the values
// kGetterProperty, kSetterProperty and kValueProperty represents
@@ -743,13 +742,6 @@ class PreParserFactory {
int pos) {
return PreParserExpression::Default();
}
-
- PreParserExpression NewCountOperation(Token::Value op,
- bool is_prefix,
- PreParserExpression expression,
- int pos) {
- return PreParserExpression::Default();
- }
};
@@ -802,10 +794,6 @@ class PreParserTraits {
return expression.IsThisProperty();
}
- static bool IsIdentifier(PreParserExpression expression) {
- return expression.IsIdentifier();
- }
-
static bool IsBoilerplateProperty(PreParserExpression property) {
// PreParser doesn't count boilerplate properties.
return false;
@@ -853,12 +841,6 @@ class PreParserTraits {
return false;
}
- PreParserExpression BuildUnaryExpression(PreParserExpression expression,
- Token::Value op, int pos,
- PreParserFactory* factory) {
- return PreParserExpression::Default();
- }
-
// Reporting errors.
void ReportMessageAt(Scanner::Location location,
const char* message,
@@ -940,7 +922,7 @@ class PreParserTraits {
int function_token_position,
FunctionLiteral::FunctionType type,
bool* ok);
- PreParserExpression ParsePostfixExpression(bool* ok);
+ PreParserExpression ParseUnaryExpression(bool* ok);
private:
PreParser* pre_parser_;
@@ -1104,6 +1086,7 @@ class PreParser : public ParserBase<PreParserTraits> {
Statement ParseTryStatement(bool* ok);
Statement ParseDebuggerStatement(bool* ok);
Expression ParseConditionalExpression(bool accept_IN, bool* ok);
+ Expression ParseUnaryExpression(bool* ok);
Expression ParsePostfixExpression(bool* ok);
Expression ParseLeftHandSideExpression(bool* ok);
Expression ParseMemberExpression(bool* ok);
@@ -1795,64 +1778,6 @@ ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, bool* ok) {
}
-template <class Traits>
-typename ParserBase<Traits>::ExpressionT
-ParserBase<Traits>::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();
- int pos = position();
- ExpressionT expression = ParseUnaryExpression(CHECK_OK);
-
- // "delete identifier" is a syntax error in strict mode.
- if (op == Token::DELETE && strict_mode() == STRICT &&
- this->IsIdentifier(expression)) {
- ReportMessage("strict_delete", Vector<const char*>::empty());
- *ok = false;
- return this->EmptyExpression();
- }
-
- // Allow Traits do rewrite the expression.
- return BuildUnaryExpression(expression, op, pos, factory());
- } else if (Token::IsCountOp(op)) {
- op = Next();
- Scanner::Location lhs_location = scanner()->peek_location();
- ExpressionT expression = ParseUnaryExpression(CHECK_OK);
- if (!this->IsValidLeftHandSide(expression)) {
- ReportMessageAt(lhs_location, "invalid_lhs_in_prefix_op", true);
- *ok = false;
- return this->EmptyExpression();
- }
-
- if (strict_mode() == STRICT) {
- // Prefix expression operand in strict mode may not be eval or arguments.
- CheckStrictModeLValue(expression, CHECK_OK);
- }
- MarkExpressionAsLValue(expression);
-
- return factory()->NewCountOperation(op,
- true /* prefix */,
- expression,
- position());
-
- } else {
- return this->ParsePostfixExpression(ok);
- }
-}
-
-
#undef CHECK_OK
#undef CHECK_OK_CUSTOM
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698