OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/ast/ast.h" | 5 #include "src/ast/ast.h" |
6 #include "src/messages.h" | 6 #include "src/messages.h" |
7 #include "src/parsing/parameter-initializer-rewriter.h" | 7 #include "src/parsing/parameter-initializer-rewriter.h" |
8 #include "src/parsing/parser.h" | 8 #include "src/parsing/parser.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 | 11 |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 void Parser::PatternRewriter::DeclareAndInitializeVariables( | 14 void Parser::PatternRewriter::DeclareAndInitializeVariables( |
15 Block* block, const DeclarationDescriptor* declaration_descriptor, | 15 Parser* parser, Block* block, |
| 16 const DeclarationDescriptor* declaration_descriptor, |
16 const DeclarationParsingResult::Declaration* declaration, | 17 const DeclarationParsingResult::Declaration* declaration, |
17 ZoneList<const AstRawString*>* names, bool* ok) { | 18 ZoneList<const AstRawString*>* names, bool* ok) { |
18 PatternRewriter rewriter; | 19 PatternRewriter rewriter; |
19 | 20 |
20 DCHECK(block->ignore_completion_value()); | 21 DCHECK(block->ignore_completion_value()); |
21 | 22 |
22 rewriter.scope_ = declaration_descriptor->scope; | 23 rewriter.scope_ = declaration_descriptor->scope; |
23 rewriter.parser_ = declaration_descriptor->parser; | 24 rewriter.parser_ = parser; |
24 rewriter.context_ = BINDING; | 25 rewriter.context_ = BINDING; |
25 rewriter.pattern_ = declaration->pattern; | 26 rewriter.pattern_ = declaration->pattern; |
26 rewriter.initializer_position_ = declaration->initializer_position; | 27 rewriter.initializer_position_ = declaration->initializer_position; |
27 rewriter.block_ = block; | 28 rewriter.block_ = block; |
28 rewriter.descriptor_ = declaration_descriptor; | 29 rewriter.descriptor_ = declaration_descriptor; |
29 rewriter.names_ = names; | 30 rewriter.names_ = names; |
30 rewriter.ok_ = ok; | 31 rewriter.ok_ = ok; |
31 rewriter.recursion_level_ = 0; | 32 rewriter.recursion_level_ = 0; |
32 | 33 |
33 rewriter.RecurseIntoSubpattern(rewriter.pattern_, declaration->initializer); | 34 rewriter.RecurseIntoSubpattern(rewriter.pattern_, declaration->initializer); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 NOT_A_PATTERN(TryFinallyStatement) | 703 NOT_A_PATTERN(TryFinallyStatement) |
703 NOT_A_PATTERN(UnaryOperation) | 704 NOT_A_PATTERN(UnaryOperation) |
704 NOT_A_PATTERN(VariableDeclaration) | 705 NOT_A_PATTERN(VariableDeclaration) |
705 NOT_A_PATTERN(WhileStatement) | 706 NOT_A_PATTERN(WhileStatement) |
706 NOT_A_PATTERN(WithStatement) | 707 NOT_A_PATTERN(WithStatement) |
707 NOT_A_PATTERN(Yield) | 708 NOT_A_PATTERN(Yield) |
708 | 709 |
709 #undef NOT_A_PATTERN | 710 #undef NOT_A_PATTERN |
710 } // namespace internal | 711 } // namespace internal |
711 } // namespace v8 | 712 } // namespace v8 |
OLD | NEW |