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 4565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4576 Block* param_block = init_block; | 4576 Block* param_block = init_block; |
4577 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) { | 4577 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) { |
4578 param_scope = NewScope(scope_, BLOCK_SCOPE); | 4578 param_scope = NewScope(scope_, BLOCK_SCOPE); |
4579 param_scope->set_is_declaration_scope(); | 4579 param_scope->set_is_declaration_scope(); |
4580 param_scope->set_start_position(descriptor.initialization_pos); | 4580 param_scope->set_start_position(descriptor.initialization_pos); |
4581 param_scope->set_end_position(parameter.initializer_end_position); | 4581 param_scope->set_end_position(parameter.initializer_end_position); |
4582 param_scope->RecordEvalCall(); | 4582 param_scope->RecordEvalCall(); |
4583 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition); | 4583 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition); |
4584 param_block->set_scope(param_scope); | 4584 param_block->set_scope(param_scope); |
4585 descriptor.hoist_scope = scope_; | 4585 descriptor.hoist_scope = scope_; |
| 4586 // Pass the appropriate scope in so that PatternRewriter can appropriately |
| 4587 // rewrite inner initializers of the pattern to param_scope |
| 4588 descriptor.scope = param_scope; |
| 4589 // Rewrite the outer initializer to point to param_scope |
| 4590 RewriteParameterInitializerScope(stack_limit(), initial_value, scope_, |
| 4591 param_scope); |
4586 } | 4592 } |
4587 | 4593 |
4588 { | 4594 { |
4589 BlockState block_state(&scope_, param_scope); | 4595 BlockState block_state(&scope_, param_scope); |
4590 DeclarationParsingResult::Declaration decl( | 4596 DeclarationParsingResult::Declaration decl( |
4591 parameter.pattern, initializer_position, initial_value); | 4597 parameter.pattern, initializer_position, initial_value); |
4592 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, | 4598 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, |
4593 &decl, nullptr, CHECK_OK); | 4599 &decl, nullptr, CHECK_OK); |
4594 } | 4600 } |
4595 | 4601 |
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6921 try_block, target); | 6927 try_block, target); |
6922 final_loop = target; | 6928 final_loop = target; |
6923 } | 6929 } |
6924 | 6930 |
6925 return final_loop; | 6931 return final_loop; |
6926 } | 6932 } |
6927 | 6933 |
6928 | 6934 |
6929 } // namespace internal | 6935 } // namespace internal |
6930 } // namespace v8 | 6936 } // namespace v8 |
OLD | NEW |