| 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.h" | 10 #include "src/ast/ast.h" |
| (...skipping 4752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4763 param_block->set_scope(param_scope); | 4763 param_block->set_scope(param_scope); |
| 4764 descriptor.hoist_scope = scope(); | 4764 descriptor.hoist_scope = scope(); |
| 4765 // Pass the appropriate scope in so that PatternRewriter can appropriately | 4765 // Pass the appropriate scope in so that PatternRewriter can appropriately |
| 4766 // rewrite inner initializers of the pattern to param_scope | 4766 // rewrite inner initializers of the pattern to param_scope |
| 4767 descriptor.scope = param_scope; | 4767 descriptor.scope = param_scope; |
| 4768 // Rewrite the outer initializer to point to param_scope | 4768 // Rewrite the outer initializer to point to param_scope |
| 4769 ReparentParameterExpressionScope(stack_limit(), initial_value, | 4769 ReparentParameterExpressionScope(stack_limit(), initial_value, |
| 4770 param_scope); | 4770 param_scope); |
| 4771 } | 4771 } |
| 4772 | 4772 |
| 4773 { | 4773 BlockState block_state(&scope_state_, param_scope); |
| 4774 BlockState block_state(&scope_state_, param_scope); | 4774 DeclarationParsingResult::Declaration decl( |
| 4775 DeclarationParsingResult::Declaration decl( | 4775 parameter.pattern, initializer_position, initial_value); |
| 4776 parameter.pattern, initializer_position, initial_value); | 4776 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, |
| 4777 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, | 4777 &decl, nullptr, CHECK_OK); |
| 4778 &decl, nullptr, CHECK_OK); | |
| 4779 } | |
| 4780 | 4778 |
| 4781 if (!parameter.is_simple() && scope()->calls_sloppy_eval()) { | 4779 if (param_block != init_block) { |
| 4782 param_scope = param_scope->FinalizeBlockScope(); | 4780 param_scope = block_state.FinalizedBlockScope(); |
| 4783 if (param_scope != nullptr) { | 4781 if (param_scope != nullptr) { |
| 4784 CheckConflictingVarDeclarations(param_scope, CHECK_OK); | 4782 CheckConflictingVarDeclarations(param_scope, CHECK_OK); |
| 4785 } | 4783 } |
| 4786 init_block->statements()->Add(param_block, zone()); | 4784 init_block->statements()->Add(param_block, zone()); |
| 4787 } | 4785 } |
| 4788 } | 4786 } |
| 4789 return init_block; | 4787 return init_block; |
| 4790 } | 4788 } |
| 4791 | 4789 |
| 4792 Block* Parser::BuildRejectPromiseOnException(Block* block) { | 4790 Block* Parser::BuildRejectPromiseOnException(Block* block) { |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7154 node->Print(Isolate::Current()); | 7152 node->Print(Isolate::Current()); |
| 7155 } | 7153 } |
| 7156 #endif // DEBUG | 7154 #endif // DEBUG |
| 7157 | 7155 |
| 7158 #undef CHECK_OK | 7156 #undef CHECK_OK |
| 7159 #undef CHECK_OK_VOID | 7157 #undef CHECK_OK_VOID |
| 7160 #undef CHECK_FAILED | 7158 #undef CHECK_FAILED |
| 7161 | 7159 |
| 7162 } // namespace internal | 7160 } // namespace internal |
| 7163 } // namespace v8 | 7161 } // namespace v8 |
| OLD | NEW |