Chromium Code Reviews| 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.h" | 5 #include "src/ast.h" |
| 6 #include "src/messages.h" | 6 #include "src/messages.h" |
| 7 #include "src/parser.h" | 7 #include "src/parser.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 } else { | 168 } else { |
| 169 initialize = NULL; | 169 initialize = NULL; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 if (initialize != NULL) { | 173 if (initialize != NULL) { |
| 174 block_->statements()->Add( | 174 block_->statements()->Add( |
| 175 factory()->NewExpressionStatement(initialize, RelocInfo::kNoPosition), | 175 factory()->NewExpressionStatement(initialize, RelocInfo::kNoPosition), |
| 176 zone()); | 176 zone()); |
| 177 } | 177 } |
| 178 } else if (value != nullptr && (descriptor_->needs_init || | 178 } else if (value != nullptr && (descriptor_->mode == CONST_LEGACY || |
|
adamk
2015/10/05 22:17:51
I like this better, too; the old code is very odd
| |
| 179 IsLexicalVariableMode(descriptor_->mode))) { | 179 IsLexicalVariableMode(descriptor_->mode))) { |
| 180 // Constant initializations always assign to the declared constant which | 180 // Constant initializations always assign to the declared constant which |
| 181 // is always at the function scope level. This is only relevant for | 181 // is always at the function scope level. This is only relevant for |
| 182 // dynamically looked-up variables and constants (the | 182 // dynamically looked-up variables and constants (the |
| 183 // start context for constant lookups is always the function context, | 183 // start context for constant lookups is always the function context, |
| 184 // while it is the top context for var declared variables). Sigh... | 184 // while it is the top context for var declared variables). Sigh... |
| 185 // For 'let' and 'const' declared variables in harmony mode the | 185 // For 'let' and 'const' declared variables in harmony mode the |
| 186 // initialization also always assigns to the declared variable. | 186 // initialization also always assigns to the declared variable. |
| 187 DCHECK_NOT_NULL(proxy); | 187 DCHECK_NOT_NULL(proxy); |
| 188 DCHECK_NOT_NULL(proxy->var()); | 188 DCHECK_NOT_NULL(proxy->var()); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 NOT_A_PATTERN(TryFinallyStatement) | 411 NOT_A_PATTERN(TryFinallyStatement) |
| 412 NOT_A_PATTERN(UnaryOperation) | 412 NOT_A_PATTERN(UnaryOperation) |
| 413 NOT_A_PATTERN(VariableDeclaration) | 413 NOT_A_PATTERN(VariableDeclaration) |
| 414 NOT_A_PATTERN(WhileStatement) | 414 NOT_A_PATTERN(WhileStatement) |
| 415 NOT_A_PATTERN(WithStatement) | 415 NOT_A_PATTERN(WithStatement) |
| 416 NOT_A_PATTERN(Yield) | 416 NOT_A_PATTERN(Yield) |
| 417 | 417 |
| 418 #undef NOT_A_PATTERN | 418 #undef NOT_A_PATTERN |
| 419 } // namespace internal | 419 } // namespace internal |
| 420 } // namespace v8 | 420 } // namespace v8 |
| OLD | NEW |