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_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 DCHECK(is_resumable()); | 378 DCHECK(is_resumable()); |
379 generator_object_variable_ = variable; | 379 generator_object_variable_ = variable; |
380 } | 380 } |
381 typename Traits::Type::GeneratorVariable* generator_object_variable() | 381 typename Traits::Type::GeneratorVariable* generator_object_variable() |
382 const { | 382 const { |
383 return generator_object_variable_; | 383 return generator_object_variable_; |
384 } | 384 } |
385 | 385 |
386 typename Traits::Type::Factory* factory() { return factory_; } | 386 typename Traits::Type::Factory* factory() { return factory_; } |
387 | 387 |
388 const List<DestructuringAssignment>& destructuring_assignments_to_rewrite() | 388 const ZoneList<DestructuringAssignment>& |
389 const { | 389 destructuring_assignments_to_rewrite() const { |
390 return destructuring_assignments_to_rewrite_; | 390 return destructuring_assignments_to_rewrite_; |
391 } | 391 } |
392 | 392 |
393 TailCallExpressionList& tail_call_expressions() { | 393 TailCallExpressionList& tail_call_expressions() { |
394 return tail_call_expressions_; | 394 return tail_call_expressions_; |
395 } | 395 } |
396 void AddImplicitTailCallExpression(ExpressionT expression) { | 396 void AddImplicitTailCallExpression(ExpressionT expression) { |
397 if (return_expr_context() == | 397 if (return_expr_context() == |
398 ReturnExprContext::kInsideValidReturnStatement) { | 398 ReturnExprContext::kInsideValidReturnStatement) { |
399 tail_call_expressions_.AddImplicitTailCall(expression); | 399 tail_call_expressions_.AddImplicitTailCall(expression); |
400 } | 400 } |
401 } | 401 } |
402 void AddExplicitTailCallExpression(ExpressionT expression, | 402 void AddExplicitTailCallExpression(ExpressionT expression, |
403 const Scanner::Location& loc) { | 403 const Scanner::Location& loc) { |
404 DCHECK(expression->IsCall()); | 404 DCHECK(expression->IsCall()); |
405 if (return_expr_context() == | 405 if (return_expr_context() == |
406 ReturnExprContext::kInsideValidReturnStatement) { | 406 ReturnExprContext::kInsideValidReturnStatement) { |
407 tail_call_expressions_.AddExplicitTailCall(expression, loc); | 407 tail_call_expressions_.AddExplicitTailCall(expression, loc); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
| 411 ZoneList<typename ExpressionClassifier::Error>* GetReportedErrorList() { |
| 412 return &reported_errors_; |
| 413 } |
| 414 |
411 ReturnExprContext return_expr_context() const { | 415 ReturnExprContext return_expr_context() const { |
412 return return_expr_context_; | 416 return return_expr_context_; |
413 } | 417 } |
414 void set_return_expr_context(ReturnExprContext context) { | 418 void set_return_expr_context(ReturnExprContext context) { |
415 return_expr_context_ = context; | 419 return_expr_context_ = context; |
416 } | 420 } |
417 | 421 |
418 ZoneList<ExpressionT>* non_patterns_to_rewrite() { | 422 ZoneList<ExpressionT>* non_patterns_to_rewrite() { |
419 return &non_patterns_to_rewrite_; | 423 return &non_patterns_to_rewrite_; |
420 } | 424 } |
421 | 425 |
422 void next_function_is_parenthesized(bool parenthesized) { | 426 void next_function_is_parenthesized(bool parenthesized) { |
423 next_function_is_parenthesized_ = parenthesized; | 427 next_function_is_parenthesized_ = parenthesized; |
424 } | 428 } |
425 | 429 |
426 bool this_function_is_parenthesized() const { | 430 bool this_function_is_parenthesized() const { |
427 return this_function_is_parenthesized_; | 431 return this_function_is_parenthesized_; |
428 } | 432 } |
429 | 433 |
430 private: | 434 private: |
431 void AddDestructuringAssignment(DestructuringAssignment pair) { | 435 void AddDestructuringAssignment(DestructuringAssignment pair) { |
432 destructuring_assignments_to_rewrite_.Add(pair); | 436 destructuring_assignments_to_rewrite_.Add(pair, (*scope_stack_)->zone()); |
433 } | 437 } |
434 | 438 |
435 V8_INLINE Scope* scope() { return *scope_stack_; } | 439 V8_INLINE Scope* scope() { return *scope_stack_; } |
436 | 440 |
437 void AddNonPatternForRewriting(ExpressionT expr) { | 441 void AddNonPatternForRewriting(ExpressionT expr, bool* ok) { |
438 non_patterns_to_rewrite_.Add(expr, (*scope_stack_)->zone()); | 442 non_patterns_to_rewrite_.Add(expr, (*scope_stack_)->zone()); |
| 443 if (non_patterns_to_rewrite_.length() >= |
| 444 std::numeric_limits<uint16_t>::max()) |
| 445 *ok = false; |
439 } | 446 } |
440 | 447 |
441 // Used to assign an index to each literal that needs materialization in | 448 // Used to assign an index to each literal that needs materialization in |
442 // the function. Includes regexp literals, and boilerplate for object and | 449 // the function. Includes regexp literals, and boilerplate for object and |
443 // array literals. | 450 // array literals. |
444 int next_materialized_literal_index_; | 451 int next_materialized_literal_index_; |
445 | 452 |
446 // Properties count estimation. | 453 // Properties count estimation. |
447 int expected_property_count_; | 454 int expected_property_count_; |
448 | 455 |
(...skipping 10 matching lines...) Expand all Loading... |
459 // For generators, this variable may hold the generator object. It variable | 466 // For generators, this variable may hold the generator object. It variable |
460 // is used by yield expressions and return statements. It is not necessary | 467 // is used by yield expressions and return statements. It is not necessary |
461 // for generator functions to have this variable set. | 468 // for generator functions to have this variable set. |
462 Variable* generator_object_variable_; | 469 Variable* generator_object_variable_; |
463 | 470 |
464 FunctionState** function_state_stack_; | 471 FunctionState** function_state_stack_; |
465 FunctionState* outer_function_state_; | 472 FunctionState* outer_function_state_; |
466 Scope** scope_stack_; | 473 Scope** scope_stack_; |
467 Scope* outer_scope_; | 474 Scope* outer_scope_; |
468 | 475 |
469 List<DestructuringAssignment> destructuring_assignments_to_rewrite_; | 476 ZoneList<DestructuringAssignment> destructuring_assignments_to_rewrite_; |
470 TailCallExpressionList tail_call_expressions_; | 477 TailCallExpressionList tail_call_expressions_; |
471 ReturnExprContext return_expr_context_; | 478 ReturnExprContext return_expr_context_; |
472 ZoneList<ExpressionT> non_patterns_to_rewrite_; | 479 ZoneList<ExpressionT> non_patterns_to_rewrite_; |
473 | 480 |
| 481 ZoneList<typename ExpressionClassifier::Error> reported_errors_; |
| 482 |
474 typename Traits::Type::Factory* factory_; | 483 typename Traits::Type::Factory* factory_; |
475 | 484 |
476 // If true, the next (and immediately following) function literal is | 485 // If true, the next (and immediately following) function literal is |
477 // preceded by a parenthesis. | 486 // preceded by a parenthesis. |
478 bool next_function_is_parenthesized_; | 487 bool next_function_is_parenthesized_; |
479 | 488 |
480 // The value of the parents' next_function_is_parenthesized_, as it applies | 489 // The value of the parents' next_function_is_parenthesized_, as it applies |
481 // to this function. Filled in by constructor. | 490 // to this function. Filled in by constructor. |
482 bool this_function_is_parenthesized_; | 491 bool this_function_is_parenthesized_; |
483 | 492 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 expected_property_count_(0), | 1195 expected_property_count_(0), |
1187 this_location_(Scanner::Location::invalid()), | 1196 this_location_(Scanner::Location::invalid()), |
1188 return_location_(Scanner::Location::invalid()), | 1197 return_location_(Scanner::Location::invalid()), |
1189 super_location_(Scanner::Location::invalid()), | 1198 super_location_(Scanner::Location::invalid()), |
1190 kind_(kind), | 1199 kind_(kind), |
1191 generator_object_variable_(NULL), | 1200 generator_object_variable_(NULL), |
1192 function_state_stack_(function_state_stack), | 1201 function_state_stack_(function_state_stack), |
1193 outer_function_state_(*function_state_stack), | 1202 outer_function_state_(*function_state_stack), |
1194 scope_stack_(scope_stack), | 1203 scope_stack_(scope_stack), |
1195 outer_scope_(*scope_stack), | 1204 outer_scope_(*scope_stack), |
| 1205 destructuring_assignments_to_rewrite_(16, scope->zone()), |
1196 tail_call_expressions_(scope->zone()), | 1206 tail_call_expressions_(scope->zone()), |
1197 return_expr_context_(ReturnExprContext::kInsideValidBlock), | 1207 return_expr_context_(ReturnExprContext::kInsideValidBlock), |
1198 non_patterns_to_rewrite_(0, scope->zone()), | 1208 non_patterns_to_rewrite_(0, scope->zone()), |
| 1209 reported_errors_(16, scope->zone()), |
1199 factory_(factory), | 1210 factory_(factory), |
1200 next_function_is_parenthesized_(false), | 1211 next_function_is_parenthesized_(false), |
1201 this_function_is_parenthesized_(false) { | 1212 this_function_is_parenthesized_(false) { |
1202 *scope_stack_ = scope; | 1213 *scope_stack_ = scope; |
1203 *function_state_stack = this; | 1214 *function_state_stack = this; |
1204 if (outer_function_state_) { | 1215 if (outer_function_state_) { |
1205 this_function_is_parenthesized_ = | 1216 this_function_is_parenthesized_ = |
1206 outer_function_state_->next_function_is_parenthesized_; | 1217 outer_function_state_->next_function_is_parenthesized_; |
1207 outer_function_state_->next_function_is_parenthesized_ = false; | 1218 outer_function_state_->next_function_is_parenthesized_ = false; |
1208 } | 1219 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 | 1556 |
1546 case Token::LBRACE: | 1557 case Token::LBRACE: |
1547 return this->ParseObjectLiteral(classifier, ok); | 1558 return this->ParseObjectLiteral(classifier, ok); |
1548 | 1559 |
1549 case Token::LPAREN: { | 1560 case Token::LPAREN: { |
1550 // Arrow function formal parameters are either a single identifier or a | 1561 // Arrow function formal parameters are either a single identifier or a |
1551 // list of BindingPattern productions enclosed in parentheses. | 1562 // list of BindingPattern productions enclosed in parentheses. |
1552 // Parentheses are not valid on the LHS of a BindingPattern, so we use the | 1563 // Parentheses are not valid on the LHS of a BindingPattern, so we use the |
1553 // is_valid_binding_pattern() check to detect multiple levels of | 1564 // is_valid_binding_pattern() check to detect multiple levels of |
1554 // parenthesization. | 1565 // parenthesization. |
1555 if (!classifier->is_valid_binding_pattern()) { | 1566 bool pattern_error = !classifier->is_valid_binding_pattern(); |
1556 ArrowFormalParametersUnexpectedToken(classifier); | |
1557 } | |
1558 classifier->RecordPatternError(scanner()->peek_location(), | 1567 classifier->RecordPatternError(scanner()->peek_location(), |
1559 MessageTemplate::kUnexpectedToken, | 1568 MessageTemplate::kUnexpectedToken, |
1560 Token::String(Token::LPAREN)); | 1569 Token::String(Token::LPAREN)); |
| 1570 if (pattern_error) ArrowFormalParametersUnexpectedToken(classifier); |
1561 Consume(Token::LPAREN); | 1571 Consume(Token::LPAREN); |
1562 if (Check(Token::RPAREN)) { | 1572 if (Check(Token::RPAREN)) { |
1563 // ()=>x. The continuation that looks for the => is in | 1573 // ()=>x. The continuation that looks for the => is in |
1564 // ParseAssignmentExpression. | 1574 // ParseAssignmentExpression. |
1565 classifier->RecordExpressionError(scanner()->location(), | 1575 classifier->RecordExpressionError(scanner()->location(), |
1566 MessageTemplate::kUnexpectedToken, | 1576 MessageTemplate::kUnexpectedToken, |
1567 Token::String(Token::RPAREN)); | 1577 Token::String(Token::RPAREN)); |
1568 return factory()->NewEmptyParentheses(beg_pos); | 1578 return factory()->NewEmptyParentheses(beg_pos); |
1569 } else if (Check(Token::ELLIPSIS)) { | 1579 } else if (Check(Token::ELLIPSIS)) { |
1570 // (...x)=>x. The continuation that looks for the => is in | 1580 // (...x)=>x. The continuation that looks for the => is in |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 if (peek() == Token::ELLIPSIS) { | 1693 if (peek() == Token::ELLIPSIS) { |
1684 // 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only | 1694 // 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only |
1685 // as the formal parameters of'(x, y, ...z) => foo', and is not itself a | 1695 // as the formal parameters of'(x, y, ...z) => foo', and is not itself a |
1686 // valid expression or binding pattern. | 1696 // valid expression or binding pattern. |
1687 ExpressionUnexpectedToken(classifier); | 1697 ExpressionUnexpectedToken(classifier); |
1688 BindingPatternUnexpectedToken(classifier); | 1698 BindingPatternUnexpectedToken(classifier); |
1689 Consume(Token::ELLIPSIS); | 1699 Consume(Token::ELLIPSIS); |
1690 seen_rest = is_rest = true; | 1700 seen_rest = is_rest = true; |
1691 } | 1701 } |
1692 int pos = position(), expr_pos = peek_position(); | 1702 int pos = position(), expr_pos = peek_position(); |
| 1703 ExpressionClassifier binding_classifier(this); |
1693 ExpressionT right = this->ParseAssignmentExpression( | 1704 ExpressionT right = this->ParseAssignmentExpression( |
1694 accept_IN, &binding_classifier, CHECK_OK); | 1705 accept_IN, &binding_classifier, CHECK_OK); |
1695 classifier->Accumulate(&binding_classifier, | 1706 classifier->Accumulate(&binding_classifier, |
1696 ExpressionClassifier::AllProductions); | 1707 ExpressionClassifier::AllProductions); |
1697 if (is_rest) { | 1708 if (is_rest) { |
1698 if (!this->IsIdentifier(right) && !IsValidPattern(right)) { | 1709 if (!this->IsIdentifier(right) && !IsValidPattern(right)) { |
1699 classifier->RecordArrowFormalParametersError( | 1710 classifier->RecordArrowFormalParametersError( |
1700 Scanner::Location(pos, scanner()->location().end_pos), | 1711 Scanner::Location(pos, scanner()->location().end_pos), |
1701 MessageTemplate::kInvalidRestParameter); | 1712 MessageTemplate::kInvalidRestParameter); |
1702 } | 1713 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 } | 1781 } |
1771 Expect(Token::RBRACK, CHECK_OK); | 1782 Expect(Token::RBRACK, CHECK_OK); |
1772 | 1783 |
1773 // Update the scope information before the pre-parsing bailout. | 1784 // Update the scope information before the pre-parsing bailout. |
1774 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 1785 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
1775 | 1786 |
1776 ExpressionT result = factory()->NewArrayLiteral(values, first_spread_index, | 1787 ExpressionT result = factory()->NewArrayLiteral(values, first_spread_index, |
1777 literal_index, pos); | 1788 literal_index, pos); |
1778 if (first_spread_index >= 0) { | 1789 if (first_spread_index >= 0) { |
1779 result = factory()->NewRewritableExpression(result); | 1790 result = factory()->NewRewritableExpression(result); |
1780 Traits::QueueNonPatternForRewriting(result); | 1791 Traits::QueueNonPatternForRewriting(result, ok); |
| 1792 if (!*ok) { |
| 1793 // If the non-pattern rewriting mechanism is used in the future for |
| 1794 // rewriting other things than spreads, this error message will have |
| 1795 // to change. Also, this error message will never appear while pre- |
| 1796 // parsing (this is OK, as it is an implementation limitation). |
| 1797 ReportMessage(MessageTemplate::kTooManySpreads); |
| 1798 return this->EmptyExpression(); |
| 1799 } |
1781 } | 1800 } |
1782 return result; | 1801 return result; |
1783 } | 1802 } |
1784 | 1803 |
1785 template <class Traits> | 1804 template <class Traits> |
1786 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 1805 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
1787 IdentifierT* name, bool* is_get, bool* is_set, bool* is_await, | 1806 IdentifierT* name, bool* is_get, bool* is_set, bool* is_await, |
1788 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 1807 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { |
1789 Token::Value token = peek(); | 1808 Token::Value token = peek(); |
1790 int pos = peek_position(); | 1809 int pos = peek_position(); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 | 2236 |
2218 if (is_async && peek_any_identifier() && PeekAhead() == Token::ARROW) { | 2237 if (is_async && peek_any_identifier() && PeekAhead() == Token::ARROW) { |
2219 // async Identifier => AsyncConciseBody | 2238 // async Identifier => AsyncConciseBody |
2220 IdentifierT name = | 2239 IdentifierT name = |
2221 ParseAndClassifyIdentifier(&arrow_formals_classifier, CHECK_OK); | 2240 ParseAndClassifyIdentifier(&arrow_formals_classifier, CHECK_OK); |
2222 expression = this->ExpressionFromIdentifier( | 2241 expression = this->ExpressionFromIdentifier( |
2223 name, position(), scanner()->location().end_pos, scope_, factory()); | 2242 name, position(), scanner()->location().end_pos, scope_, factory()); |
2224 } | 2243 } |
2225 | 2244 |
2226 if (peek() == Token::ARROW) { | 2245 if (peek() == Token::ARROW) { |
2227 classifier->RecordPatternError(scanner()->peek_location(), | 2246 Scanner::Location arrow_loc = scanner()->peek_location(); |
2228 MessageTemplate::kUnexpectedToken, | |
2229 Token::String(Token::ARROW)); | |
2230 ValidateArrowFormalParameters(&arrow_formals_classifier, expression, | 2247 ValidateArrowFormalParameters(&arrow_formals_classifier, expression, |
2231 parenthesized_formals, is_async, CHECK_OK); | 2248 parenthesized_formals, is_async, CHECK_OK); |
2232 // This reads strangely, but is correct: it checks whether any | 2249 // This reads strangely, but is correct: it checks whether any |
2233 // sub-expression of the parameter list failed to be a valid formal | 2250 // sub-expression of the parameter list failed to be a valid formal |
2234 // parameter initializer. Since YieldExpressions are banned anywhere | 2251 // parameter initializer. Since YieldExpressions are banned anywhere |
2235 // in an arrow parameter list, this is correct. | 2252 // in an arrow parameter list, this is correct. |
2236 // TODO(adamk): Rename "FormalParameterInitializerError" to refer to | 2253 // TODO(adamk): Rename "FormalParameterInitializerError" to refer to |
2237 // "YieldExpression", which is its only use. | 2254 // "YieldExpression", which is its only use. |
2238 ValidateFormalParameterInitializer(&arrow_formals_classifier, ok); | 2255 ValidateFormalParameterInitializer(&arrow_formals_classifier, ok); |
2239 | 2256 |
(...skipping 16 matching lines...) Expand all Loading... |
2256 scope->set_start_position(lhs_beg_pos); | 2273 scope->set_start_position(lhs_beg_pos); |
2257 Scanner::Location duplicate_loc = Scanner::Location::invalid(); | 2274 Scanner::Location duplicate_loc = Scanner::Location::invalid(); |
2258 this->ParseArrowFunctionFormalParameterList(¶meters, expression, loc, | 2275 this->ParseArrowFunctionFormalParameterList(¶meters, expression, loc, |
2259 &duplicate_loc, CHECK_OK); | 2276 &duplicate_loc, CHECK_OK); |
2260 if (duplicate_loc.IsValid()) { | 2277 if (duplicate_loc.IsValid()) { |
2261 arrow_formals_classifier.RecordDuplicateFormalParameterError( | 2278 arrow_formals_classifier.RecordDuplicateFormalParameterError( |
2262 duplicate_loc); | 2279 duplicate_loc); |
2263 } | 2280 } |
2264 expression = this->ParseArrowFunctionLiteral( | 2281 expression = this->ParseArrowFunctionLiteral( |
2265 accept_IN, parameters, is_async, arrow_formals_classifier, CHECK_OK); | 2282 accept_IN, parameters, is_async, arrow_formals_classifier, CHECK_OK); |
| 2283 arrow_formals_classifier.Discard(); |
| 2284 classifier->RecordPatternError(arrow_loc, |
| 2285 MessageTemplate::kUnexpectedToken, |
| 2286 Token::String(Token::ARROW)); |
2266 | 2287 |
2267 if (fni_ != nullptr) fni_->Infer(); | 2288 if (fni_ != nullptr) fni_->Infer(); |
2268 | 2289 |
2269 return expression; | 2290 return expression; |
2270 } | 2291 } |
2271 | 2292 |
2272 if (this->IsValidReferenceExpression(expression)) { | 2293 if (this->IsValidReferenceExpression(expression)) { |
2273 arrow_formals_classifier.ForgiveAssignmentPatternError(); | 2294 arrow_formals_classifier.ForgiveAssignmentPatternError(); |
2274 } | 2295 } |
2275 | 2296 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 // LogicalOrExpression | 2516 // LogicalOrExpression |
2496 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression | 2517 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression |
2497 | 2518 |
2498 int pos = peek_position(); | 2519 int pos = peek_position(); |
2499 // We start using the binary expression parser for prec >= 4 only! | 2520 // We start using the binary expression parser for prec >= 4 only! |
2500 ExpressionT expression = | 2521 ExpressionT expression = |
2501 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); | 2522 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); |
2502 if (peek() != Token::CONDITIONAL) return expression; | 2523 if (peek() != Token::CONDITIONAL) return expression; |
2503 CheckNoTailCallExpressions(classifier, CHECK_OK); | 2524 CheckNoTailCallExpressions(classifier, CHECK_OK); |
2504 Traits::RewriteNonPattern(classifier, CHECK_OK); | 2525 Traits::RewriteNonPattern(classifier, CHECK_OK); |
| 2526 BindingPatternUnexpectedToken(classifier); |
2505 ArrowFormalParametersUnexpectedToken(classifier); | 2527 ArrowFormalParametersUnexpectedToken(classifier); |
2506 BindingPatternUnexpectedToken(classifier); | |
2507 Consume(Token::CONDITIONAL); | 2528 Consume(Token::CONDITIONAL); |
2508 // In parsing the first assignment expression in conditional | 2529 // In parsing the first assignment expression in conditional |
2509 // expressions we always accept the 'in' keyword; see ECMA-262, | 2530 // expressions we always accept the 'in' keyword; see ECMA-262, |
2510 // section 11.12, page 58. | 2531 // section 11.12, page 58. |
2511 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); | 2532 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); |
2512 Traits::RewriteNonPattern(classifier, CHECK_OK); | 2533 Traits::RewriteNonPattern(classifier, CHECK_OK); |
2513 Expect(Token::COLON, CHECK_OK); | 2534 Expect(Token::COLON, CHECK_OK); |
2514 ExpressionT right = | 2535 ExpressionT right = |
2515 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); | 2536 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); |
2516 Traits::RewriteNonPattern(classifier, CHECK_OK); | 2537 Traits::RewriteNonPattern(classifier, CHECK_OK); |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3593 has_seen_constructor_ = true; | 3614 has_seen_constructor_ = true; |
3594 return; | 3615 return; |
3595 } | 3616 } |
3596 } | 3617 } |
3597 | 3618 |
3598 | 3619 |
3599 } // namespace internal | 3620 } // namespace internal |
3600 } // namespace v8 | 3621 } // namespace v8 |
3601 | 3622 |
3602 #endif // V8_PARSING_PARSER_BASE_H | 3623 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |