| 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/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 struct CatchInfo { | 636 struct CatchInfo { |
| 637 public: | 637 public: |
| 638 explicit CatchInfo(ParserBase* parser) | 638 explicit CatchInfo(ParserBase* parser) |
| 639 : name(parser->impl()->EmptyIdentifier()), | 639 : name(parser->impl()->EmptyIdentifier()), |
| 640 variable(nullptr), | 640 variable(nullptr), |
| 641 pattern(parser->impl()->EmptyExpression()), | 641 pattern(parser->impl()->EmptyExpression()), |
| 642 scope(nullptr), | 642 scope(nullptr), |
| 643 init_block(parser->impl()->NullBlock()), | 643 init_block(parser->impl()->NullBlock()), |
| 644 inner_block(parser->impl()->NullBlock()), | 644 inner_block(parser->impl()->NullBlock()), |
| 645 for_promise_reject(false), | |
| 646 bound_names(1, parser->zone()), | 645 bound_names(1, parser->zone()), |
| 647 tail_call_expressions(parser->zone()) {} | 646 tail_call_expressions(parser->zone()) {} |
| 648 IdentifierT name; | 647 IdentifierT name; |
| 649 Variable* variable; | 648 Variable* variable; |
| 650 ExpressionT pattern; | 649 ExpressionT pattern; |
| 651 Scope* scope; | 650 Scope* scope; |
| 652 BlockT init_block; | 651 BlockT init_block; |
| 653 BlockT inner_block; | 652 BlockT inner_block; |
| 654 bool for_promise_reject; | |
| 655 ZoneList<const AstRawString*> bound_names; | 653 ZoneList<const AstRawString*> bound_names; |
| 656 TailCallExpressionList tail_call_expressions; | 654 TailCallExpressionList tail_call_expressions; |
| 657 }; | 655 }; |
| 658 | 656 |
| 659 struct ForInfo { | 657 struct ForInfo { |
| 660 public: | 658 public: |
| 661 explicit ForInfo(ParserBase* parser) | 659 explicit ForInfo(ParserBase* parser) |
| 662 : bound_names(1, parser->zone()), | 660 : bound_names(1, parser->zone()), |
| 663 mode(ForEachStatement::ENUMERATE), | 661 mode(ForEachStatement::ENUMERATE), |
| 664 position(kNoSourcePosition), | 662 position(kNoSourcePosition), |
| (...skipping 4449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5114 int pos = position(); | 5112 int pos = position(); |
| 5115 | 5113 |
| 5116 BlockT try_block = impl()->NullBlock(); | 5114 BlockT try_block = impl()->NullBlock(); |
| 5117 { | 5115 { |
| 5118 ReturnExprScope no_tail_calls(function_state_, | 5116 ReturnExprScope no_tail_calls(function_state_, |
| 5119 ReturnExprContext::kInsideTryBlock); | 5117 ReturnExprContext::kInsideTryBlock); |
| 5120 try_block = ParseBlock(nullptr, CHECK_OK); | 5118 try_block = ParseBlock(nullptr, CHECK_OK); |
| 5121 } | 5119 } |
| 5122 | 5120 |
| 5123 CatchInfo catch_info(this); | 5121 CatchInfo catch_info(this); |
| 5124 catch_info.for_promise_reject = allow_natives() && Check(Token::MOD); | |
| 5125 | 5122 |
| 5126 if (peek() != Token::CATCH && peek() != Token::FINALLY) { | 5123 if (peek() != Token::CATCH && peek() != Token::FINALLY) { |
| 5127 ReportMessage(MessageTemplate::kNoCatchOrFinally); | 5124 ReportMessage(MessageTemplate::kNoCatchOrFinally); |
| 5128 *ok = false; | 5125 *ok = false; |
| 5129 return impl()->NullStatement(); | 5126 return impl()->NullStatement(); |
| 5130 } | 5127 } |
| 5131 | 5128 |
| 5132 BlockT catch_block = impl()->NullBlock(); | 5129 BlockT catch_block = impl()->NullBlock(); |
| 5133 if (Check(Token::CATCH)) { | 5130 if (Check(Token::CATCH)) { |
| 5134 Expect(Token::LPAREN, CHECK_OK); | 5131 Expect(Token::LPAREN, CHECK_OK); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5502 has_seen_constructor_ = true; | 5499 has_seen_constructor_ = true; |
| 5503 return; | 5500 return; |
| 5504 } | 5501 } |
| 5505 } | 5502 } |
| 5506 | 5503 |
| 5507 | 5504 |
| 5508 } // namespace internal | 5505 } // namespace internal |
| 5509 } // namespace v8 | 5506 } // namespace v8 |
| 5510 | 5507 |
| 5511 #endif // V8_PARSING_PARSER_BASE_H | 5508 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |