| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 VariableProxy* proxy = initialization_scope->NewUnresolved(factory(), name); | 205 VariableProxy* proxy = initialization_scope->NewUnresolved(factory(), name); |
| 206 Assignment* assignment = factory()->NewAssignment( | 206 Assignment* assignment = factory()->NewAssignment( |
| 207 descriptor_->init_op, proxy, value, descriptor_->initialization_pos); | 207 descriptor_->init_op, proxy, value, descriptor_->initialization_pos); |
| 208 block_->AddStatement( | 208 block_->AddStatement( |
| 209 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 209 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
| 210 zone()); | 210 zone()); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 | 214 |
| 215 void Parser::PatternRewriter::VisitRestParameter(RestParameter* node) { |
| 216 // Rest parameter rewriting handled specially in the parser, but must still |
| 217 // be declared. |
| 218 DCHECK_EQ(DeclarationDescriptor::PARAMETER, descriptor_->declaration_kind); |
| 219 VisitVariableProxy(node->parameter()); |
| 220 } |
| 221 |
| 222 |
| 215 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { | 223 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { |
| 216 auto temp = descriptor_->parser->scope_->NewTemporary( | 224 auto temp = descriptor_->parser->scope_->NewTemporary( |
| 217 ast_value_factory()->empty_string()); | 225 ast_value_factory()->empty_string()); |
| 218 if (value != nullptr) { | 226 if (value != nullptr) { |
| 219 auto assignment = factory()->NewAssignment( | 227 auto assignment = factory()->NewAssignment( |
| 220 Token::ASSIGN, factory()->NewVariableProxy(temp), value, | 228 Token::ASSIGN, factory()->NewVariableProxy(temp), value, |
| 221 RelocInfo::kNoPosition); | 229 RelocInfo::kNoPosition); |
| 222 | 230 |
| 223 block_->AddStatement( | 231 block_->AddStatement( |
| 224 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 232 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 NOT_A_PATTERN(TryFinallyStatement) | 426 NOT_A_PATTERN(TryFinallyStatement) |
| 419 NOT_A_PATTERN(UnaryOperation) | 427 NOT_A_PATTERN(UnaryOperation) |
| 420 NOT_A_PATTERN(VariableDeclaration) | 428 NOT_A_PATTERN(VariableDeclaration) |
| 421 NOT_A_PATTERN(WhileStatement) | 429 NOT_A_PATTERN(WhileStatement) |
| 422 NOT_A_PATTERN(WithStatement) | 430 NOT_A_PATTERN(WithStatement) |
| 423 NOT_A_PATTERN(Yield) | 431 NOT_A_PATTERN(Yield) |
| 424 | 432 |
| 425 #undef NOT_A_PATTERN | 433 #undef NOT_A_PATTERN |
| 426 } // namespace internal | 434 } // namespace internal |
| 427 } // namespace v8 | 435 } // namespace v8 |
| OLD | NEW |