| 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/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 8 #include "src/parsing/parameter-initializer-rewriter.h" | 8 #include "src/parsing/parameter-initializer-rewriter.h" |
| 9 #include "src/parsing/parser.h" | 9 #include "src/parsing/parser.h" |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (names_) { | 170 if (names_) { |
| 171 names_->Add(name, zone()); | 171 names_->Add(name, zone()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 Scope* var_init_scope = descriptor_->scope; | 174 Scope* var_init_scope = descriptor_->scope; |
| 175 MarkTopLevelVariableAsAssigned(var_init_scope, proxy); | 175 MarkTopLevelVariableAsAssigned(var_init_scope, proxy); |
| 176 | 176 |
| 177 // If there's no initializer, we're done. | 177 // If there's no initializer, we're done. |
| 178 if (value == nullptr) return; | 178 if (value == nullptr) return; |
| 179 | 179 |
| 180 MarkLoopVariableAsAssigned(var_init_scope, proxy->var()); |
| 181 |
| 180 // A declaration of the form: | 182 // A declaration of the form: |
| 181 // | 183 // |
| 182 // var v = x; | 184 // var v = x; |
| 183 // | 185 // |
| 184 // is syntactic sugar for: | 186 // is syntactic sugar for: |
| 185 // | 187 // |
| 186 // var v; v = x; | 188 // var v; v = x; |
| 187 // | 189 // |
| 188 // In particular, we need to re-lookup 'v' as it may be a different | 190 // In particular, we need to re-lookup 'v' as it may be a different |
| 189 // 'v' than the 'v' in the declaration (e.g., if we are inside a | 191 // 'v' than the 'v' in the declaration (e.g., if we are inside a |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 NOT_A_PATTERN(TryFinallyStatement) | 760 NOT_A_PATTERN(TryFinallyStatement) |
| 759 NOT_A_PATTERN(UnaryOperation) | 761 NOT_A_PATTERN(UnaryOperation) |
| 760 NOT_A_PATTERN(VariableDeclaration) | 762 NOT_A_PATTERN(VariableDeclaration) |
| 761 NOT_A_PATTERN(WhileStatement) | 763 NOT_A_PATTERN(WhileStatement) |
| 762 NOT_A_PATTERN(WithStatement) | 764 NOT_A_PATTERN(WithStatement) |
| 763 NOT_A_PATTERN(Yield) | 765 NOT_A_PATTERN(Yield) |
| 764 | 766 |
| 765 #undef NOT_A_PATTERN | 767 #undef NOT_A_PATTERN |
| 766 } // namespace internal | 768 } // namespace internal |
| 767 } // namespace v8 | 769 } // namespace v8 |
| OLD | NEW |