| 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 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 switch_block->statements()->Add( | 1658 switch_block->statements()->Add( |
| 1659 factory()->NewExpressionStatement( | 1659 factory()->NewExpressionStatement( |
| 1660 factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition), | 1660 factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition), |
| 1661 zone()); | 1661 zone()); |
| 1662 | 1662 |
| 1663 Expression* tag_read = factory()->NewVariableProxy(tag_variable); | 1663 Expression* tag_read = factory()->NewVariableProxy(tag_variable); |
| 1664 switch_statement->Initialize(tag_read, cases); | 1664 switch_statement->Initialize(tag_read, cases); |
| 1665 Block* cases_block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition); | 1665 Block* cases_block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition); |
| 1666 cases_block->statements()->Add(switch_statement, zone()); | 1666 cases_block->statements()->Add(switch_statement, zone()); |
| 1667 cases_block->set_scope(scope); | 1667 cases_block->set_scope(scope); |
| 1668 DCHECK_IMPLIES(scope != nullptr, |
| 1669 switch_statement->position() >= scope->start_position()); |
| 1670 DCHECK_IMPLIES(scope != nullptr, |
| 1671 switch_statement->position() < scope->end_position()); |
| 1668 switch_block->statements()->Add(cases_block, zone()); | 1672 switch_block->statements()->Add(cases_block, zone()); |
| 1669 return switch_block; | 1673 return switch_block; |
| 1670 } | 1674 } |
| 1671 | 1675 |
| 1672 void Parser::RewriteCatchPattern(CatchInfo* catch_info, bool* ok) { | 1676 void Parser::RewriteCatchPattern(CatchInfo* catch_info, bool* ok) { |
| 1673 if (catch_info->name == nullptr) { | 1677 if (catch_info->name == nullptr) { |
| 1674 DCHECK_NOT_NULL(catch_info->pattern); | 1678 DCHECK_NOT_NULL(catch_info->pattern); |
| 1675 catch_info->name = ast_value_factory()->dot_catch_string(); | 1679 catch_info->name = ast_value_factory()->dot_catch_string(); |
| 1676 } | 1680 } |
| 1677 Variable* catch_variable = | 1681 Variable* catch_variable = |
| (...skipping 3355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5033 | 5037 |
| 5034 return final_loop; | 5038 return final_loop; |
| 5035 } | 5039 } |
| 5036 | 5040 |
| 5037 #undef CHECK_OK | 5041 #undef CHECK_OK |
| 5038 #undef CHECK_OK_VOID | 5042 #undef CHECK_OK_VOID |
| 5039 #undef CHECK_FAILED | 5043 #undef CHECK_FAILED |
| 5040 | 5044 |
| 5041 } // namespace internal | 5045 } // namespace internal |
| 5042 } // namespace v8 | 5046 } // namespace v8 |
| OLD | NEW |