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

Side by Side Diff: src/preparser.cc

Issue 194503004: Move ParseArguments to 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
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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 } 1131 }
1132 default: 1132 default:
1133 return expression; 1133 return expression;
1134 } 1134 }
1135 } 1135 }
1136 ASSERT(false); 1136 ASSERT(false);
1137 return PreParserExpression::Default(); 1137 return PreParserExpression::Default();
1138 } 1138 }
1139 1139
1140 1140
1141 PreParser::Arguments PreParser::ParseArguments(bool* ok) {
1142 // Arguments ::
1143 // '(' (AssignmentExpression)*[','] ')'
1144
1145 Expect(Token::LPAREN, ok);
1146 if (!*ok) return -1;
1147 bool done = (peek() == Token::RPAREN);
1148 int argc = 0;
1149 while (!done) {
1150 ParseAssignmentExpression(true, ok);
1151 if (!*ok) return -1;
1152 argc++;
1153 done = (peek() == Token::RPAREN);
1154 if (!done) {
1155 Expect(Token::COMMA, ok);
1156 if (!*ok) return -1;
1157 }
1158 }
1159 Expect(Token::RPAREN, ok);
1160 return argc;
1161 }
1162
1163 PreParser::Expression PreParser::ParseFunctionLiteral( 1141 PreParser::Expression PreParser::ParseFunctionLiteral(
1164 Identifier function_name, 1142 Identifier function_name,
1165 Scanner::Location function_name_location, 1143 Scanner::Location function_name_location,
1166 bool name_is_strict_reserved, 1144 bool name_is_strict_reserved,
1167 bool is_generator, 1145 bool is_generator,
1168 int function_token_pos, 1146 int function_token_pos,
1169 FunctionLiteral::FunctionType function_type, 1147 FunctionLiteral::FunctionType function_type,
1170 bool* ok) { 1148 bool* ok) {
1171 // Function :: 1149 // Function ::
1172 // '(' FormalParameterList? ')' '{' FunctionBody '}' 1150 // '(' FormalParameterList? ')' '{' FunctionBody '}'
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 int identifier_pos = position(); 1290 int identifier_pos = position();
1313 if (scanner()->is_literal_ascii()) { 1291 if (scanner()->is_literal_ascii()) {
1314 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_ascii_string()); 1292 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_ascii_string());
1315 } else { 1293 } else {
1316 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string()); 1294 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string());
1317 } 1295 }
1318 } 1296 }
1319 1297
1320 1298
1321 } } // v8::internal 1299 } } // v8::internal
OLDNEW
« src/preparser.h ('K') | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698