OLD | NEW |
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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 } | 1128 } |
1129 default: | 1129 default: |
1130 return expression; | 1130 return expression; |
1131 } | 1131 } |
1132 } | 1132 } |
1133 ASSERT(false); | 1133 ASSERT(false); |
1134 return PreParserExpression::Default(); | 1134 return PreParserExpression::Default(); |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
1138 PreParser::Arguments PreParser::ParseArguments(bool* ok) { | |
1139 // Arguments :: | |
1140 // '(' (AssignmentExpression)*[','] ')' | |
1141 | |
1142 Expect(Token::LPAREN, ok); | |
1143 if (!*ok) return -1; | |
1144 bool done = (peek() == Token::RPAREN); | |
1145 int argc = 0; | |
1146 while (!done) { | |
1147 ParseAssignmentExpression(true, ok); | |
1148 if (!*ok) return -1; | |
1149 argc++; | |
1150 done = (peek() == Token::RPAREN); | |
1151 if (!done) { | |
1152 Expect(Token::COMMA, ok); | |
1153 if (!*ok) return -1; | |
1154 } | |
1155 } | |
1156 Expect(Token::RPAREN, ok); | |
1157 return argc; | |
1158 } | |
1159 | |
1160 PreParser::Expression PreParser::ParseFunctionLiteral( | 1138 PreParser::Expression PreParser::ParseFunctionLiteral( |
1161 Identifier function_name, | 1139 Identifier function_name, |
1162 Scanner::Location function_name_location, | 1140 Scanner::Location function_name_location, |
1163 bool name_is_strict_reserved, | 1141 bool name_is_strict_reserved, |
1164 bool is_generator, | 1142 bool is_generator, |
1165 int function_token_pos, | 1143 int function_token_pos, |
1166 FunctionLiteral::FunctionType function_type, | 1144 FunctionLiteral::FunctionType function_type, |
1167 bool* ok) { | 1145 bool* ok) { |
1168 // Function :: | 1146 // Function :: |
1169 // '(' FormalParameterList? ')' '{' FunctionBody '}' | 1147 // '(' FormalParameterList? ')' '{' FunctionBody '}' |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 int identifier_pos = position(); | 1287 int identifier_pos = position(); |
1310 if (scanner()->is_literal_ascii()) { | 1288 if (scanner()->is_literal_ascii()) { |
1311 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_ascii_string()); | 1289 log_->LogAsciiSymbol(identifier_pos, scanner()->literal_ascii_string()); |
1312 } else { | 1290 } else { |
1313 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string()); | 1291 log_->LogUtf16Symbol(identifier_pos, scanner()->literal_utf16_string()); |
1314 } | 1292 } |
1315 } | 1293 } |
1316 | 1294 |
1317 | 1295 |
1318 } } // v8::internal | 1296 } } // v8::internal |
OLD | NEW |