| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 for (ObjectLiteralProperty* property : *pattern->properties()) { | 237 for (ObjectLiteralProperty* property : *pattern->properties()) { |
| 238 RecurseIntoSubpattern( | 238 RecurseIntoSubpattern( |
| 239 property->value(), | 239 property->value(), |
| 240 factory()->NewProperty(factory()->NewVariableProxy(temp), | 240 factory()->NewProperty(factory()->NewVariableProxy(temp), |
| 241 property->key(), RelocInfo::kNoPosition)); | 241 property->key(), RelocInfo::kNoPosition)); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { | 246 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { |
| 247 auto iterator = CreateTempVar( | 247 auto temp = CreateTempVar(current_value_); |
| 248 descriptor_->parser->GetIterator(current_value_, factory())); | 248 |
| 249 block_->statements()->Add(descriptor_->parser->BuildAssertIsCoercible(temp), |
| 250 zone()); |
| 251 |
| 252 auto iterator = CreateTempVar(descriptor_->parser->GetIterator( |
| 253 factory()->NewVariableProxy(temp), factory())); |
| 249 auto done = CreateTempVar( | 254 auto done = CreateTempVar( |
| 250 factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition)); | 255 factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition)); |
| 251 auto result = CreateTempVar(); | 256 auto result = CreateTempVar(); |
| 252 auto v = CreateTempVar(); | 257 auto v = CreateTempVar(); |
| 253 | 258 |
| 254 Spread* spread = nullptr; | 259 Spread* spread = nullptr; |
| 255 for (Expression* value : *node->values()) { | 260 for (Expression* value : *node->values()) { |
| 256 if (value->IsSpread()) { | 261 if (value->IsSpread()) { |
| 257 spread = value->AsSpread(); | 262 spread = value->AsSpread(); |
| 258 break; | 263 break; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 NOT_A_PATTERN(TryFinallyStatement) | 416 NOT_A_PATTERN(TryFinallyStatement) |
| 412 NOT_A_PATTERN(UnaryOperation) | 417 NOT_A_PATTERN(UnaryOperation) |
| 413 NOT_A_PATTERN(VariableDeclaration) | 418 NOT_A_PATTERN(VariableDeclaration) |
| 414 NOT_A_PATTERN(WhileStatement) | 419 NOT_A_PATTERN(WhileStatement) |
| 415 NOT_A_PATTERN(WithStatement) | 420 NOT_A_PATTERN(WithStatement) |
| 416 NOT_A_PATTERN(Yield) | 421 NOT_A_PATTERN(Yield) |
| 417 | 422 |
| 418 #undef NOT_A_PATTERN | 423 #undef NOT_A_PATTERN |
| 419 } // namespace internal | 424 } // namespace internal |
| 420 } // namespace v8 | 425 } // namespace v8 |
| OLD | NEW |