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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 bool is_generator, 139 bool is_generator,
140 int function_token_position, 140 int function_token_position,
141 FunctionLiteral::FunctionType type, 141 FunctionLiteral::FunctionType type,
142 bool* ok) { 142 bool* ok) {
143 return pre_parser_->ParseFunctionLiteral( 143 return pre_parser_->ParseFunctionLiteral(
144 name, function_name_location, name_is_strict_reserved, is_generator, 144 name, function_name_location, name_is_strict_reserved, is_generator,
145 function_token_position, type, ok); 145 function_token_position, type, ok);
146 } 146 }
147 147
148 148
149 PreParserExpression PreParserTraits::ParsePostfixExpression(bool* ok) { 149 PreParserExpression PreParserTraits::ParseUnaryExpression(bool* ok) {
150 return pre_parser_->ParsePostfixExpression(ok); 150 return pre_parser_->ParseUnaryExpression(ok);
151 } 151 }
152 152
153 153
154 PreParser::PreParseResult PreParser::PreParseLazyFunction( 154 PreParser::PreParseResult PreParser::PreParseLazyFunction(
155 StrictMode strict_mode, bool is_generator, ParserRecorder* log) { 155 StrictMode strict_mode, bool is_generator, ParserRecorder* log) {
156 log_ = log; 156 log_ = log;
157 // Lazy functions always have trivial outer scopes (no with/catch scopes). 157 // Lazy functions always have trivial outer scopes (no with/catch scopes).
158 PreParserScope top_scope(scope_, GLOBAL_SCOPE); 158 PreParserScope top_scope(scope_, GLOBAL_SCOPE);
159 FunctionState top_state(&function_state_, &scope_, &top_scope); 159 FunctionState top_state(&function_state_, &scope_, &top_scope);
160 scope_->SetStrictMode(strict_mode); 160 scope_->SetStrictMode(strict_mode);
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 836
837 #undef CHECK_OK 837 #undef CHECK_OK
838 #define CHECK_OK ok); \ 838 #define CHECK_OK ok); \
839 if (!*ok) return Expression::Default(); \ 839 if (!*ok) return Expression::Default(); \
840 ((void)0 840 ((void)0
841 #define DUMMY ) // to make indentation work 841 #define DUMMY ) // to make indentation work
842 #undef DUMMY 842 #undef DUMMY
843 843
844 844
845 PreParser::Expression PreParser::ParseUnaryExpression(bool* ok) {
846 // UnaryExpression ::
847 // PostfixExpression
848 // 'delete' UnaryExpression
849 // 'void' UnaryExpression
850 // 'typeof' UnaryExpression
851 // '++' UnaryExpression
852 // '--' UnaryExpression
853 // '+' UnaryExpression
854 // '-' UnaryExpression
855 // '~' UnaryExpression
856 // '!' UnaryExpression
857
858 Token::Value op = peek();
859 if (Token::IsUnaryOp(op)) {
860 op = Next();
861 ParseUnaryExpression(ok);
862 return Expression::Default();
863 } else if (Token::IsCountOp(op)) {
864 op = Next();
865 Expression expression = ParseUnaryExpression(CHECK_OK);
866 if (strict_mode() == STRICT) {
867 CheckStrictModeLValue(expression, CHECK_OK);
868 }
869 return Expression::Default();
870 } else {
871 return ParsePostfixExpression(ok);
872 }
873 }
874
875
845 PreParser::Expression PreParser::ParsePostfixExpression(bool* ok) { 876 PreParser::Expression PreParser::ParsePostfixExpression(bool* ok) {
846 // PostfixExpression :: 877 // PostfixExpression ::
847 // LeftHandSideExpression ('++' | '--')? 878 // LeftHandSideExpression ('++' | '--')?
848 879
849 Expression expression = ParseLeftHandSideExpression(CHECK_OK); 880 Expression expression = ParseLeftHandSideExpression(CHECK_OK);
850 if (!scanner()->HasAnyLineTerminatorBeforeNext() && 881 if (!scanner()->HasAnyLineTerminatorBeforeNext() &&
851 Token::IsCountOp(peek())) { 882 Token::IsCountOp(peek())) {
852 if (strict_mode() == STRICT) { 883 if (strict_mode() == STRICT) {
853 CheckStrictModeLValue(expression, CHECK_OK); 884 CheckStrictModeLValue(expression, CHECK_OK);
854 } 885 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 1177
1147 1178
1148 void PreParser::LogSymbol() { 1179 void PreParser::LogSymbol() {
1149 if (log_->ShouldLogSymbols()) { 1180 if (log_->ShouldLogSymbols()) {
1150 scanner()->LogSymbol(log_, position()); 1181 scanner()->LogSymbol(log_, position());
1151 } 1182 }
1152 } 1183 }
1153 1184
1154 1185
1155 } } // v8::internal 1186 } } // v8::internal
OLDNEW
« 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