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

Side by Side Diff: src/preparser.cc

Issue 197353003: Move ParseYieldExpression to ParserBase. (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') | no next file » | 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool is_generator, 135 bool is_generator,
136 int function_token_position, 136 int function_token_position,
137 FunctionLiteral::FunctionType type, 137 FunctionLiteral::FunctionType type,
138 bool* ok) { 138 bool* ok) {
139 return pre_parser_->ParseFunctionLiteral( 139 return pre_parser_->ParseFunctionLiteral(
140 name, function_name_location, name_is_strict_reserved, is_generator, 140 name, function_name_location, name_is_strict_reserved, is_generator,
141 function_token_position, type, ok); 141 function_token_position, type, ok);
142 } 142 }
143 143
144 144
145 PreParserExpression PreParserTraits::ParseYieldExpression(bool* ok) {
146 return pre_parser_->ParseYieldExpression(ok);
147 }
148
149
150 PreParserExpression PreParserTraits::ParseConditionalExpression(bool accept_IN, 145 PreParserExpression PreParserTraits::ParseConditionalExpression(bool accept_IN,
151 bool* ok) { 146 bool* ok) {
152 return pre_parser_->ParseConditionalExpression(accept_IN, ok); 147 return pre_parser_->ParseConditionalExpression(accept_IN, ok);
153 } 148 }
154 149
155 150
156 PreParser::PreParseResult PreParser::PreParseLazyFunction( 151 PreParser::PreParseResult PreParser::PreParseLazyFunction(
157 StrictMode strict_mode, bool is_generator, ParserRecorder* log) { 152 StrictMode strict_mode, bool is_generator, ParserRecorder* log) {
158 log_ = log; 153 log_ = log;
159 // Lazy functions always have trivial outer scopes (no with/catch scopes). 154 // Lazy functions always have trivial outer scopes (no with/catch scopes).
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 833
839 #undef CHECK_OK 834 #undef CHECK_OK
840 #define CHECK_OK ok); \ 835 #define CHECK_OK ok); \
841 if (!*ok) return Expression::Default(); \ 836 if (!*ok) return Expression::Default(); \
842 ((void)0 837 ((void)0
843 #define DUMMY ) // to make indentation work 838 #define DUMMY ) // to make indentation work
844 #undef DUMMY 839 #undef DUMMY
845 840
846 841
847 // Precedence = 3 842 // Precedence = 3
848 PreParser::Expression PreParser::ParseYieldExpression(bool* ok) {
849 // YieldExpression ::
850 // 'yield' '*'? AssignmentExpression
851 Consume(Token::YIELD);
852 Check(Token::MUL);
853
854 ParseAssignmentExpression(false, CHECK_OK);
855
856 return Expression::Default();
857 }
858
859
860 // Precedence = 3
861 PreParser::Expression PreParser::ParseConditionalExpression(bool accept_IN, 843 PreParser::Expression PreParser::ParseConditionalExpression(bool accept_IN,
862 bool* ok) { 844 bool* ok) {
863 // ConditionalExpression :: 845 // ConditionalExpression ::
864 // LogicalOrExpression 846 // LogicalOrExpression
865 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression 847 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression
866 848
867 // We start using the binary expression parser for prec >= 4 only! 849 // We start using the binary expression parser for prec >= 4 only!
868 Expression expression = ParseBinaryExpression(4, accept_IN, CHECK_OK); 850 Expression expression = ParseBinaryExpression(4, accept_IN, CHECK_OK);
869 if (peek() != Token::CONDITIONAL) return expression; 851 if (peek() != Token::CONDITIONAL) return expression;
870 Consume(Token::CONDITIONAL); 852 Consume(Token::CONDITIONAL);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 int identifier_pos = position(); 1221 int identifier_pos = position();
1240 if (scanner()->is_literal_one_byte()) { 1222 if (scanner()->is_literal_one_byte()) {
1241 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_one_byte_string()); 1223 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_one_byte_string());
1242 } else { 1224 } else {
1243 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string()); 1225 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string());
1244 } 1226 }
1245 } 1227 }
1246 1228
1247 1229
1248 } } // v8::internal 1230 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698