OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 int pos) { | 1365 int pos) { |
1366 return PreParserExpression::Default(); | 1366 return PreParserExpression::Default(); |
1367 } | 1367 } |
1368 PreParserExpression NewNumberLiteral(double number, | 1368 PreParserExpression NewNumberLiteral(double number, |
1369 int pos) { | 1369 int pos) { |
1370 return PreParserExpression::Default(); | 1370 return PreParserExpression::Default(); |
1371 } | 1371 } |
1372 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, | 1372 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, |
1373 PreParserIdentifier js_flags, | 1373 PreParserIdentifier js_flags, |
1374 int literal_index, | 1374 int literal_index, |
| 1375 bool is_strong, |
1375 int pos) { | 1376 int pos) { |
1376 return PreParserExpression::Default(); | 1377 return PreParserExpression::Default(); |
1377 } | 1378 } |
1378 PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1379 PreParserExpression NewArrayLiteral(PreParserExpressionList values, |
1379 int literal_index, | 1380 int literal_index, |
| 1381 bool is_strong, |
1380 int pos) { | 1382 int pos) { |
1381 return PreParserExpression::Default(); | 1383 return PreParserExpression::Default(); |
1382 } | 1384 } |
1383 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1385 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1384 PreParserExpression value, | 1386 PreParserExpression value, |
1385 ObjectLiteralProperty::Kind kind, | 1387 ObjectLiteralProperty::Kind kind, |
1386 bool is_static, | 1388 bool is_static, |
1387 bool is_computed_name) { | 1389 bool is_computed_name) { |
1388 return PreParserExpression::Default(); | 1390 return PreParserExpression::Default(); |
1389 } | 1391 } |
1390 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1392 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1391 PreParserExpression value, | 1393 PreParserExpression value, |
1392 bool is_static, | 1394 bool is_static, |
1393 bool is_computed_name) { | 1395 bool is_computed_name) { |
1394 return PreParserExpression::Default(); | 1396 return PreParserExpression::Default(); |
1395 } | 1397 } |
1396 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, | 1398 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, |
1397 int literal_index, | 1399 int literal_index, |
1398 int boilerplate_properties, | 1400 int boilerplate_properties, |
1399 bool has_function, | 1401 bool has_function, |
| 1402 bool is_strong, |
1400 int pos) { | 1403 int pos) { |
1401 return PreParserExpression::Default(); | 1404 return PreParserExpression::Default(); |
1402 } | 1405 } |
1403 PreParserExpression NewVariableProxy(void* variable) { | 1406 PreParserExpression NewVariableProxy(void* variable) { |
1404 return PreParserExpression::Default(); | 1407 return PreParserExpression::Default(); |
1405 } | 1408 } |
1406 PreParserExpression NewProperty(PreParserExpression obj, | 1409 PreParserExpression NewProperty(PreParserExpression obj, |
1407 PreParserExpression key, | 1410 PreParserExpression key, |
1408 int pos) { | 1411 int pos) { |
1409 if (obj.IsThis()) { | 1412 if (obj.IsThis()) { |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 | 2246 |
2244 IdentifierT js_pattern = this->GetNextSymbol(scanner()); | 2247 IdentifierT js_pattern = this->GetNextSymbol(scanner()); |
2245 if (!scanner()->ScanRegExpFlags()) { | 2248 if (!scanner()->ScanRegExpFlags()) { |
2246 Next(); | 2249 Next(); |
2247 ReportMessage(MessageTemplate::kMalformedRegExpFlags); | 2250 ReportMessage(MessageTemplate::kMalformedRegExpFlags); |
2248 *ok = false; | 2251 *ok = false; |
2249 return Traits::EmptyExpression(); | 2252 return Traits::EmptyExpression(); |
2250 } | 2253 } |
2251 IdentifierT js_flags = this->GetNextSymbol(scanner()); | 2254 IdentifierT js_flags = this->GetNextSymbol(scanner()); |
2252 Next(); | 2255 Next(); |
2253 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos); | 2256 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, |
| 2257 is_strong(language_mode()), pos); |
2254 } | 2258 } |
2255 | 2259 |
2256 | 2260 |
2257 #define CHECK_OK ok); \ | 2261 #define CHECK_OK ok); \ |
2258 if (!*ok) return this->EmptyExpression(); \ | 2262 if (!*ok) return this->EmptyExpression(); \ |
2259 ((void)0 | 2263 ((void)0 |
2260 #define DUMMY ) // to make indentation work | 2264 #define DUMMY ) // to make indentation work |
2261 #undef DUMMY | 2265 #undef DUMMY |
2262 | 2266 |
2263 // Used in functions where the return type is not ExpressionT. | 2267 // Used in functions where the return type is not ExpressionT. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 values->Add(elem, zone_); | 2512 values->Add(elem, zone_); |
2509 if (peek() != Token::RBRACK) { | 2513 if (peek() != Token::RBRACK) { |
2510 Expect(Token::COMMA, CHECK_OK); | 2514 Expect(Token::COMMA, CHECK_OK); |
2511 } | 2515 } |
2512 } | 2516 } |
2513 Expect(Token::RBRACK, CHECK_OK); | 2517 Expect(Token::RBRACK, CHECK_OK); |
2514 | 2518 |
2515 // Update the scope information before the pre-parsing bailout. | 2519 // Update the scope information before the pre-parsing bailout. |
2516 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2520 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2517 | 2521 |
2518 return factory()->NewArrayLiteral(values, literal_index, pos); | 2522 return factory()->NewArrayLiteral(values, literal_index, |
| 2523 is_strong(language_mode()), pos); |
2519 } | 2524 } |
2520 | 2525 |
2521 | 2526 |
2522 template <class Traits> | 2527 template <class Traits> |
2523 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 2528 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
2524 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, | 2529 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, |
2525 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 2530 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { |
2526 Token::Value token = peek(); | 2531 Token::Value token = peek(); |
2527 int pos = peek_position(); | 2532 int pos = peek_position(); |
2528 | 2533 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2777 } | 2782 } |
2778 Expect(Token::RBRACE, CHECK_OK); | 2783 Expect(Token::RBRACE, CHECK_OK); |
2779 | 2784 |
2780 // Computation of literal_index must happen before pre parse bailout. | 2785 // Computation of literal_index must happen before pre parse bailout. |
2781 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2786 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2782 | 2787 |
2783 return factory()->NewObjectLiteral(properties, | 2788 return factory()->NewObjectLiteral(properties, |
2784 literal_index, | 2789 literal_index, |
2785 number_of_boilerplate_properties, | 2790 number_of_boilerplate_properties, |
2786 has_function, | 2791 has_function, |
| 2792 is_strong(language_mode()), |
2787 pos); | 2793 pos); |
2788 } | 2794 } |
2789 | 2795 |
2790 | 2796 |
2791 template <class Traits> | 2797 template <class Traits> |
2792 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( | 2798 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( |
2793 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, | 2799 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, |
2794 bool* ok) { | 2800 bool* ok) { |
2795 // Arguments :: | 2801 // Arguments :: |
2796 // '(' (AssignmentExpression)*[','] ')' | 2802 // '(' (AssignmentExpression)*[','] ')' |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 *ok = false; | 4005 *ok = false; |
4000 return; | 4006 return; |
4001 } | 4007 } |
4002 has_seen_constructor_ = true; | 4008 has_seen_constructor_ = true; |
4003 return; | 4009 return; |
4004 } | 4010 } |
4005 } | 4011 } |
4006 } } // v8::internal | 4012 } } // v8::internal |
4007 | 4013 |
4008 #endif // V8_PREPARSER_H | 4014 #endif // V8_PREPARSER_H |
OLD | NEW |