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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 int pos) { | 1333 int pos) { |
1334 return PreParserExpression::Default(); | 1334 return PreParserExpression::Default(); |
1335 } | 1335 } |
1336 PreParserExpression NewNumberLiteral(double number, | 1336 PreParserExpression NewNumberLiteral(double number, |
1337 int pos) { | 1337 int pos) { |
1338 return PreParserExpression::Default(); | 1338 return PreParserExpression::Default(); |
1339 } | 1339 } |
1340 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, | 1340 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, |
1341 PreParserIdentifier js_flags, | 1341 PreParserIdentifier js_flags, |
1342 int literal_index, | 1342 int literal_index, |
1343 bool is_strong, | |
1344 int pos) { | 1343 int pos) { |
1345 return PreParserExpression::Default(); | 1344 return PreParserExpression::Default(); |
1346 } | 1345 } |
1347 PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1346 PreParserExpression NewArrayLiteral(PreParserExpressionList values, |
1348 int literal_index, | 1347 int literal_index, |
1349 bool is_strong, | |
1350 int pos) { | 1348 int pos) { |
1351 return PreParserExpression::Default(); | 1349 return PreParserExpression::Default(); |
1352 } | 1350 } |
1353 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1351 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1354 PreParserExpression value, | 1352 PreParserExpression value, |
1355 ObjectLiteralProperty::Kind kind, | 1353 ObjectLiteralProperty::Kind kind, |
1356 bool is_static, | 1354 bool is_static, |
1357 bool is_computed_name) { | 1355 bool is_computed_name) { |
1358 return PreParserExpression::Default(); | 1356 return PreParserExpression::Default(); |
1359 } | 1357 } |
1360 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1358 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, |
1361 PreParserExpression value, | 1359 PreParserExpression value, |
1362 bool is_static, | 1360 bool is_static, |
1363 bool is_computed_name) { | 1361 bool is_computed_name) { |
1364 return PreParserExpression::Default(); | 1362 return PreParserExpression::Default(); |
1365 } | 1363 } |
1366 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, | 1364 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, |
1367 int literal_index, | 1365 int literal_index, |
1368 int boilerplate_properties, | 1366 int boilerplate_properties, |
1369 bool has_function, | 1367 bool has_function, |
1370 bool is_strong, | |
1371 int pos) { | 1368 int pos) { |
1372 return PreParserExpression::Default(); | 1369 return PreParserExpression::Default(); |
1373 } | 1370 } |
1374 PreParserExpression NewVariableProxy(void* variable) { | 1371 PreParserExpression NewVariableProxy(void* variable) { |
1375 return PreParserExpression::Default(); | 1372 return PreParserExpression::Default(); |
1376 } | 1373 } |
1377 PreParserExpression NewProperty(PreParserExpression obj, | 1374 PreParserExpression NewProperty(PreParserExpression obj, |
1378 PreParserExpression key, | 1375 PreParserExpression key, |
1379 int pos) { | 1376 int pos) { |
1380 if (obj.IsThis()) { | 1377 if (obj.IsThis()) { |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 | 2203 |
2207 IdentifierT js_pattern = this->GetNextSymbol(scanner()); | 2204 IdentifierT js_pattern = this->GetNextSymbol(scanner()); |
2208 if (!scanner()->ScanRegExpFlags()) { | 2205 if (!scanner()->ScanRegExpFlags()) { |
2209 Next(); | 2206 Next(); |
2210 ReportMessage("malformed_regexp_flags"); | 2207 ReportMessage("malformed_regexp_flags"); |
2211 *ok = false; | 2208 *ok = false; |
2212 return Traits::EmptyExpression(); | 2209 return Traits::EmptyExpression(); |
2213 } | 2210 } |
2214 IdentifierT js_flags = this->GetNextSymbol(scanner()); | 2211 IdentifierT js_flags = this->GetNextSymbol(scanner()); |
2215 Next(); | 2212 Next(); |
2216 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, | 2213 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos); |
2217 is_strong(language_mode()), pos); | |
2218 } | 2214 } |
2219 | 2215 |
2220 | 2216 |
2221 #define CHECK_OK ok); \ | 2217 #define CHECK_OK ok); \ |
2222 if (!*ok) return this->EmptyExpression(); \ | 2218 if (!*ok) return this->EmptyExpression(); \ |
2223 ((void)0 | 2219 ((void)0 |
2224 #define DUMMY ) // to make indentation work | 2220 #define DUMMY ) // to make indentation work |
2225 #undef DUMMY | 2221 #undef DUMMY |
2226 | 2222 |
2227 // Used in functions where the return type is not ExpressionT. | 2223 // Used in functions where the return type is not ExpressionT. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 values->Add(elem, zone_); | 2468 values->Add(elem, zone_); |
2473 if (peek() != Token::RBRACK) { | 2469 if (peek() != Token::RBRACK) { |
2474 Expect(Token::COMMA, CHECK_OK); | 2470 Expect(Token::COMMA, CHECK_OK); |
2475 } | 2471 } |
2476 } | 2472 } |
2477 Expect(Token::RBRACK, CHECK_OK); | 2473 Expect(Token::RBRACK, CHECK_OK); |
2478 | 2474 |
2479 // Update the scope information before the pre-parsing bailout. | 2475 // Update the scope information before the pre-parsing bailout. |
2480 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2476 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2481 | 2477 |
2482 return factory()->NewArrayLiteral(values, literal_index, | 2478 return factory()->NewArrayLiteral(values, literal_index, pos); |
2483 is_strong(language_mode()), pos); | |
2484 } | 2479 } |
2485 | 2480 |
2486 | 2481 |
2487 template <class Traits> | 2482 template <class Traits> |
2488 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 2483 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
2489 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, | 2484 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, |
2490 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 2485 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { |
2491 Token::Value token = peek(); | 2486 Token::Value token = peek(); |
2492 int pos = peek_position(); | 2487 int pos = peek_position(); |
2493 | 2488 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 } | 2724 } |
2730 Expect(Token::RBRACE, CHECK_OK); | 2725 Expect(Token::RBRACE, CHECK_OK); |
2731 | 2726 |
2732 // Computation of literal_index must happen before pre parse bailout. | 2727 // Computation of literal_index must happen before pre parse bailout. |
2733 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2728 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
2734 | 2729 |
2735 return factory()->NewObjectLiteral(properties, | 2730 return factory()->NewObjectLiteral(properties, |
2736 literal_index, | 2731 literal_index, |
2737 number_of_boilerplate_properties, | 2732 number_of_boilerplate_properties, |
2738 has_function, | 2733 has_function, |
2739 is_strong(language_mode()), | |
2740 pos); | 2734 pos); |
2741 } | 2735 } |
2742 | 2736 |
2743 | 2737 |
2744 template <class Traits> | 2738 template <class Traits> |
2745 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( | 2739 typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( |
2746 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, | 2740 Scanner::Location* first_spread_arg_loc, ExpressionClassifier* classifier, |
2747 bool* ok) { | 2741 bool* ok) { |
2748 // Arguments :: | 2742 // Arguments :: |
2749 // '(' (AssignmentExpression)*[','] ')' | 2743 // '(' (AssignmentExpression)*[','] ')' |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3929 *ok = false; | 3923 *ok = false; |
3930 return; | 3924 return; |
3931 } | 3925 } |
3932 has_seen_constructor_ = true; | 3926 has_seen_constructor_ = true; |
3933 return; | 3927 return; |
3934 } | 3928 } |
3935 } | 3929 } |
3936 } } // v8::internal | 3930 } } // v8::internal |
3937 | 3931 |
3938 #endif // V8_PREPARSER_H | 3932 #endif // V8_PREPARSER_H |
OLD | NEW |