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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 Assignment* assignment = factory()->NewAssignment( | 207 Assignment* assignment = factory()->NewAssignment( |
208 descriptor_->init_op, proxy, value, descriptor_->initialization_pos); | 208 descriptor_->init_op, proxy, value, descriptor_->initialization_pos); |
209 block_->AddStatement( | 209 block_->AddStatement( |
210 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 210 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
211 zone()); | 211 zone()); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { | 216 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { |
217 auto temp_scope = descriptor_->parser->scope_->DeclarationScope(); | 217 auto temp = descriptor_->parser->scope_->NewTemporary( |
218 auto temp = temp_scope->NewTemporary(ast_value_factory()->empty_string()); | 218 ast_value_factory()->empty_string()); |
219 if (value != nullptr) { | 219 if (value != nullptr) { |
220 auto assignment = factory()->NewAssignment( | 220 auto assignment = factory()->NewAssignment( |
221 Token::ASSIGN, factory()->NewVariableProxy(temp), value, | 221 Token::ASSIGN, factory()->NewVariableProxy(temp), value, |
222 RelocInfo::kNoPosition); | 222 RelocInfo::kNoPosition); |
223 | 223 |
224 block_->AddStatement( | 224 block_->AddStatement( |
225 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 225 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
226 zone()); | 226 zone()); |
227 } | 227 } |
228 return temp; | 228 return temp; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 NOT_A_PATTERN(TryFinallyStatement) | 414 NOT_A_PATTERN(TryFinallyStatement) |
415 NOT_A_PATTERN(UnaryOperation) | 415 NOT_A_PATTERN(UnaryOperation) |
416 NOT_A_PATTERN(VariableDeclaration) | 416 NOT_A_PATTERN(VariableDeclaration) |
417 NOT_A_PATTERN(WhileStatement) | 417 NOT_A_PATTERN(WhileStatement) |
418 NOT_A_PATTERN(WithStatement) | 418 NOT_A_PATTERN(WithStatement) |
419 NOT_A_PATTERN(Yield) | 419 NOT_A_PATTERN(Yield) |
420 | 420 |
421 #undef NOT_A_PATTERN | 421 #undef NOT_A_PATTERN |
422 } // namespace internal | 422 } // namespace internal |
423 } // namespace v8 | 423 } // namespace v8 |
OLD | NEW |