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

Side by Side Diff: src/preparser.cc

Issue 202333004: Move ParsePostfixExpression into ParserBase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: activated a test 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::ParseLeftHandSideExpression(bool* ok) {
150 return pre_parser_->ParsePostfixExpression(ok); 150 return pre_parser_->ParseLeftHandSideExpression(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::ParsePostfixExpression(bool* ok) {
846 // PostfixExpression ::
847 // LeftHandSideExpression ('++' | '--')?
848
849 Expression expression = ParseLeftHandSideExpression(CHECK_OK);
850 if (!scanner()->HasAnyLineTerminatorBeforeNext() &&
851 Token::IsCountOp(peek())) {
852 if (strict_mode() == STRICT) {
853 CheckStrictModeLValue(expression, CHECK_OK);
854 }
855 Next();
856 return Expression::Default();
857 }
858 return expression;
859 }
860
861
862 PreParser::Expression PreParser::ParseLeftHandSideExpression(bool* ok) { 845 PreParser::Expression PreParser::ParseLeftHandSideExpression(bool* ok) {
863 // LeftHandSideExpression :: 846 // LeftHandSideExpression ::
864 // (NewExpression | MemberExpression) ... 847 // (NewExpression | MemberExpression) ...
865 848
866 Expression result = ParseMemberWithNewPrefixesExpression(CHECK_OK); 849 Expression result = ParseMemberWithNewPrefixesExpression(CHECK_OK);
867 850
868 while (true) { 851 while (true) {
869 switch (peek()) { 852 switch (peek()) {
870 case Token::LBRACK: { 853 case Token::LBRACK: {
871 Consume(Token::LBRACK); 854 Consume(Token::LBRACK);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1132
1150 1133
1151 void PreParser::LogSymbol() { 1134 void PreParser::LogSymbol() {
1152 if (log_->ShouldLogSymbols()) { 1135 if (log_->ShouldLogSymbols()) {
1153 scanner()->LogSymbol(log_, position()); 1136 scanner()->LogSymbol(log_, position());
1154 } 1137 }
1155 } 1138 }
1156 1139
1157 1140
1158 } } // v8::internal 1141 } } // 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