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(!scope || switch_statement->position() >= scope->start_position()); | |
marja
2017/03/13 12:24:46
Nit: DCHECK_IMPLIES(scope != nullptr, ...)
| |
1669 DCHECK(!scope || switch_statement->position() < scope->end_position()); | |
1668 switch_block->statements()->Add(cases_block, zone()); | 1670 switch_block->statements()->Add(cases_block, zone()); |
1669 return switch_block; | 1671 return switch_block; |
1670 } | 1672 } |
1671 | 1673 |
1672 void Parser::RewriteCatchPattern(CatchInfo* catch_info, bool* ok) { | 1674 void Parser::RewriteCatchPattern(CatchInfo* catch_info, bool* ok) { |
1673 if (catch_info->name == nullptr) { | 1675 if (catch_info->name == nullptr) { |
1674 DCHECK_NOT_NULL(catch_info->pattern); | 1676 DCHECK_NOT_NULL(catch_info->pattern); |
1675 catch_info->name = ast_value_factory()->dot_catch_string(); | 1677 catch_info->name = ast_value_factory()->dot_catch_string(); |
1676 } | 1678 } |
1677 Variable* catch_variable = | 1679 Variable* catch_variable = |
(...skipping 3355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5033 | 5035 |
5034 return final_loop; | 5036 return final_loop; |
5035 } | 5037 } |
5036 | 5038 |
5037 #undef CHECK_OK | 5039 #undef CHECK_OK |
5038 #undef CHECK_OK_VOID | 5040 #undef CHECK_OK_VOID |
5039 #undef CHECK_FAILED | 5041 #undef CHECK_FAILED |
5040 | 5042 |
5041 } // namespace internal | 5043 } // namespace internal |
5042 } // namespace v8 | 5044 } // namespace v8 |
OLD | NEW |