| 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/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 // 'continue' MemberExpression TemplateLiteral | 2566 // 'continue' MemberExpression TemplateLiteral |
| 2567 // 'continue' CallExpression TemplateLiteral | 2567 // 'continue' CallExpression TemplateLiteral |
| 2568 Expect(Token::CONTINUE, CHECK_OK); | 2568 Expect(Token::CONTINUE, CHECK_OK); |
| 2569 int pos = position(); | 2569 int pos = position(); |
| 2570 int sub_expression_pos = peek_position(); | 2570 int sub_expression_pos = peek_position(); |
| 2571 ExpressionT expression = | 2571 ExpressionT expression = |
| 2572 this->ParseLeftHandSideExpression(classifier, CHECK_OK); | 2572 this->ParseLeftHandSideExpression(classifier, CHECK_OK); |
| 2573 CheckNoTailCallExpressions(classifier, CHECK_OK); | 2573 CheckNoTailCallExpressions(classifier, CHECK_OK); |
| 2574 | 2574 |
| 2575 Scanner::Location loc(pos, scanner()->location().end_pos); | 2575 Scanner::Location loc(pos, scanner()->location().end_pos); |
| 2576 |
| 2576 if (!expression->IsCall()) { | 2577 if (!expression->IsCall()) { |
| 2577 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); | 2578 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); |
| 2578 impl()->ReportMessageAt(sub_loc, | 2579 impl()->ReportMessageAt(sub_loc, |
| 2579 MessageTemplate::kUnexpectedInsideTailCall); | 2580 MessageTemplate::kUnexpectedInsideTailCall); |
| 2580 *ok = false; | 2581 *ok = false; |
| 2581 return impl()->EmptyExpression(); | 2582 return impl()->EmptyExpression(); |
| 2582 } | 2583 } |
| 2583 if (impl()->IsDirectEvalCall(expression)) { | 2584 if (impl()->IsDirectEvalCall(expression)) { |
| 2584 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); | 2585 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); |
| 2585 impl()->ReportMessageAt(sub_loc, | 2586 impl()->ReportMessageAt(sub_loc, |
| 2586 MessageTemplate::kUnexpectedTailCallOfEval); | 2587 MessageTemplate::kUnexpectedTailCallOfEval); |
| 2587 *ok = false; | 2588 *ok = false; |
| 2588 return impl()->EmptyExpression(); | 2589 return impl()->EmptyExpression(); |
| 2589 } | 2590 } |
| 2590 if (!is_strict(language_mode())) { | 2591 if (!is_strict(language_mode())) { |
| 2591 impl()->ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); | 2592 impl()->ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); |
| 2592 *ok = false; | 2593 *ok = false; |
| 2593 return impl()->EmptyExpression(); | 2594 return impl()->EmptyExpression(); |
| 2594 } | 2595 } |
| 2596 if (is_resumable()) { |
| 2597 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); |
| 2598 impl()->ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCall); |
| 2599 *ok = false; |
| 2600 return impl()->EmptyExpression(); |
| 2601 } |
| 2595 ReturnExprContext return_expr_context = | 2602 ReturnExprContext return_expr_context = |
| 2596 function_state_->return_expr_context(); | 2603 function_state_->return_expr_context(); |
| 2597 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { | 2604 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { |
| 2598 MessageTemplate::Template msg = MessageTemplate::kNone; | 2605 MessageTemplate::Template msg = MessageTemplate::kNone; |
| 2599 switch (return_expr_context) { | 2606 switch (return_expr_context) { |
| 2600 case ReturnExprContext::kInsideValidReturnStatement: | 2607 case ReturnExprContext::kInsideValidReturnStatement: |
| 2601 UNREACHABLE(); | 2608 UNREACHABLE(); |
| 2602 return impl()->EmptyExpression(); | 2609 return impl()->EmptyExpression(); |
| 2603 case ReturnExprContext::kInsideValidBlock: | 2610 case ReturnExprContext::kInsideValidBlock: |
| 2604 msg = MessageTemplate::kUnexpectedTailCall; | 2611 msg = MessageTemplate::kUnexpectedTailCall; |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3716 has_seen_constructor_ = true; | 3723 has_seen_constructor_ = true; |
| 3717 return; | 3724 return; |
| 3718 } | 3725 } |
| 3719 } | 3726 } |
| 3720 | 3727 |
| 3721 | 3728 |
| 3722 } // namespace internal | 3729 } // namespace internal |
| 3723 } // namespace v8 | 3730 } // namespace v8 |
| 3724 | 3731 |
| 3725 #endif // V8_PARSING_PARSER_BASE_H | 3732 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |