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 "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 descriptor.scope = scope_; | 3094 descriptor.scope = scope_; |
3095 descriptor.hoist_scope = nullptr; | 3095 descriptor.hoist_scope = nullptr; |
3096 descriptor.mode = LET; | 3096 descriptor.mode = LET; |
3097 descriptor.declaration_pos = pattern->position(); | 3097 descriptor.declaration_pos = pattern->position(); |
3098 descriptor.initialization_pos = pattern->position(); | 3098 descriptor.initialization_pos = pattern->position(); |
3099 | 3099 |
3100 DeclarationParsingResult::Declaration decl( | 3100 DeclarationParsingResult::Declaration decl( |
3101 pattern, pattern->position(), | 3101 pattern, pattern->position(), |
3102 factory()->NewVariableProxy(catch_variable)); | 3102 factory()->NewVariableProxy(catch_variable)); |
3103 | 3103 |
| 3104 Block* init_block = |
| 3105 factory()->NewBlock(nullptr, 8, true, RelocInfo::kNoPosition); |
3104 PatternRewriter::DeclareAndInitializeVariables( | 3106 PatternRewriter::DeclareAndInitializeVariables( |
3105 catch_block, &descriptor, &decl, nullptr, CHECK_OK); | 3107 init_block, &descriptor, &decl, nullptr, CHECK_OK); |
| 3108 catch_block->statements()->Add(init_block, zone()); |
3106 } | 3109 } |
3107 | 3110 |
3108 Expect(Token::LBRACE, CHECK_OK); | 3111 Expect(Token::LBRACE, CHECK_OK); |
3109 while (peek() != Token::RBRACE) { | 3112 while (peek() != Token::RBRACE) { |
3110 Statement* stat = ParseStatementListItem(CHECK_OK); | 3113 Statement* stat = ParseStatementListItem(CHECK_OK); |
3111 if (stat && !stat->IsEmpty()) { | 3114 if (stat && !stat->IsEmpty()) { |
3112 catch_block->statements()->Add(stat, zone()); | 3115 catch_block->statements()->Add(stat, zone()); |
3113 } | 3116 } |
3114 } | 3117 } |
3115 Consume(Token::RBRACE); | 3118 Consume(Token::RBRACE); |
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6893 Expression* do_each = | 6896 Expression* do_each = |
6894 factory->NewDoExpression(new_assign_each, var_each, nopos); | 6897 factory->NewDoExpression(new_assign_each, var_each, nopos); |
6895 loop->set_assign_each(do_each); | 6898 loop->set_assign_each(do_each); |
6896 | 6899 |
6897 return final_loop; | 6900 return final_loop; |
6898 } | 6901 } |
6899 | 6902 |
6900 | 6903 |
6901 } // namespace internal | 6904 } // namespace internal |
6902 } // namespace v8 | 6905 } // namespace v8 |
OLD | NEW |