| 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 { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // is declared (and set to 'undefined') upon entering the function within | 139 // is declared (and set to 'undefined') upon entering the function within |
| 140 // which the variable or constant is declared. Only function variables have | 140 // which the variable or constant is declared. Only function variables have |
| 141 // an initial value in the declaration (because they are initialized upon | 141 // an initial value in the declaration (because they are initialized upon |
| 142 // entering the function). | 142 // entering the function). |
| 143 const AstRawString* name = pattern->raw_name(); | 143 const AstRawString* name = pattern->raw_name(); |
| 144 VariableProxy* proxy = descriptor_->scope->NewUnresolved( | 144 VariableProxy* proxy = descriptor_->scope->NewUnresolved( |
| 145 factory(), name, parser_->scanner()->location().beg_pos, | 145 factory(), name, parser_->scanner()->location().beg_pos, |
| 146 parser_->scanner()->location().end_pos); | 146 parser_->scanner()->location().end_pos); |
| 147 Declaration* declaration = factory()->NewVariableDeclaration( | 147 Declaration* declaration = factory()->NewVariableDeclaration( |
| 148 proxy, descriptor_->scope, descriptor_->declaration_pos); | 148 proxy, descriptor_->scope, descriptor_->declaration_pos); |
| 149 Variable* var = parser_->Declare(declaration, descriptor_->declaration_kind, | 149 Variable* var = parser_->Declare( |
| 150 descriptor_->mode, | 150 declaration, descriptor_->declaration_kind, descriptor_->mode, |
| 151 DefaultInitializationFlag(descriptor_->mode), | 151 Variable::DefaultInitializationFlag(descriptor_->mode), ok_, |
| 152 ok_, descriptor_->hoist_scope); | 152 descriptor_->hoist_scope); |
| 153 if (!*ok_) return; | 153 if (!*ok_) return; |
| 154 DCHECK_NOT_NULL(var); | 154 DCHECK_NOT_NULL(var); |
| 155 DCHECK(proxy->is_resolved()); | 155 DCHECK(proxy->is_resolved()); |
| 156 DCHECK(initializer_position_ != kNoSourcePosition); | 156 DCHECK(initializer_position_ != kNoSourcePosition); |
| 157 var->set_initializer_position(initializer_position_); | 157 var->set_initializer_position(initializer_position_); |
| 158 | 158 |
| 159 // TODO(adamk): This should probably be checking hoist_scope. | 159 // TODO(adamk): This should probably be checking hoist_scope. |
| 160 // Move it to Parser::Declare() to make it easier to test | 160 // Move it to Parser::Declare() to make it easier to test |
| 161 // the right scope. | 161 // the right scope. |
| 162 Scope* declaration_scope = IsLexicalVariableMode(descriptor_->mode) | 162 Scope* declaration_scope = IsLexicalVariableMode(descriptor_->mode) |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 NOT_A_PATTERN(TryFinallyStatement) | 698 NOT_A_PATTERN(TryFinallyStatement) |
| 699 NOT_A_PATTERN(UnaryOperation) | 699 NOT_A_PATTERN(UnaryOperation) |
| 700 NOT_A_PATTERN(VariableDeclaration) | 700 NOT_A_PATTERN(VariableDeclaration) |
| 701 NOT_A_PATTERN(WhileStatement) | 701 NOT_A_PATTERN(WhileStatement) |
| 702 NOT_A_PATTERN(WithStatement) | 702 NOT_A_PATTERN(WithStatement) |
| 703 NOT_A_PATTERN(Yield) | 703 NOT_A_PATTERN(Yield) |
| 704 | 704 |
| 705 #undef NOT_A_PATTERN | 705 #undef NOT_A_PATTERN |
| 706 } // namespace internal | 706 } // namespace internal |
| 707 } // namespace v8 | 707 } // namespace v8 |
| OLD | NEW |