| 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/parameter-initializer-rewriter.h" | 7 #include "src/parameter-initializer-rewriter.h" |
| 8 #include "src/parser.h" | 8 #include "src/parser.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // We may want to pass singleton to avoid Literal allocations. | 151 // We may want to pass singleton to avoid Literal allocations. |
| 152 LanguageMode language_mode = initialization_scope->language_mode(); | 152 LanguageMode language_mode = initialization_scope->language_mode(); |
| 153 arguments->Add(factory()->NewNumberLiteral(language_mode, | 153 arguments->Add(factory()->NewNumberLiteral(language_mode, |
| 154 descriptor_->declaration_pos), | 154 descriptor_->declaration_pos), |
| 155 zone()); | 155 zone()); |
| 156 | 156 |
| 157 // Be careful not to assign a value to the global variable if | 157 // Be careful not to assign a value to the global variable if |
| 158 // we're in a with. The initialization value should not | 158 // we're in a with. The initialization value should not |
| 159 // necessarily be stored in the global object in that case, | 159 // necessarily be stored in the global object in that case, |
| 160 // which is why we need to generate a separate assignment node. | 160 // which is why we need to generate a separate assignment node. |
| 161 if (value != NULL && !inside_with()) { | 161 if (value != NULL && !descriptor_->scope->inside_with()) { |
| 162 arguments->Add(value, zone()); | 162 arguments->Add(value, zone()); |
| 163 value = NULL; // zap the value to avoid the unnecessary assignment | 163 value = NULL; // zap the value to avoid the unnecessary assignment |
| 164 // Construct the call to Runtime_InitializeVarGlobal | 164 // Construct the call to Runtime_InitializeVarGlobal |
| 165 // and add it to the initialization statement block. | 165 // and add it to the initialization statement block. |
| 166 initialize = | 166 initialize = |
| 167 factory()->NewCallRuntime(Runtime::kInitializeVarGlobal, arguments, | 167 factory()->NewCallRuntime(Runtime::kInitializeVarGlobal, arguments, |
| 168 descriptor_->declaration_pos); | 168 descriptor_->declaration_pos); |
| 169 } else { | 169 } else { |
| 170 initialize = NULL; | 170 initialize = NULL; |
| 171 } | 171 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 NOT_A_PATTERN(TryFinallyStatement) | 426 NOT_A_PATTERN(TryFinallyStatement) |
| 427 NOT_A_PATTERN(UnaryOperation) | 427 NOT_A_PATTERN(UnaryOperation) |
| 428 NOT_A_PATTERN(VariableDeclaration) | 428 NOT_A_PATTERN(VariableDeclaration) |
| 429 NOT_A_PATTERN(WhileStatement) | 429 NOT_A_PATTERN(WhileStatement) |
| 430 NOT_A_PATTERN(WithStatement) | 430 NOT_A_PATTERN(WithStatement) |
| 431 NOT_A_PATTERN(Yield) | 431 NOT_A_PATTERN(Yield) |
| 432 | 432 |
| 433 #undef NOT_A_PATTERN | 433 #undef NOT_A_PATTERN |
| 434 } // namespace internal | 434 } // namespace internal |
| 435 } // namespace v8 | 435 } // namespace v8 |
| OLD | NEW |