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/ast.h" | 5 #include "src/ast/ast.h" |
6 #include "src/messages.h" | 6 #include "src/messages.h" |
7 #include "src/parsing/parameter-initializer-rewriter.h" | 7 #include "src/parsing/parameter-initializer-rewriter.h" |
8 #include "src/parsing/parser.h" | 8 #include "src/parsing/parser.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 481 } |
482 | 482 |
483 if (spread != nullptr) { | 483 if (spread != nullptr) { |
484 // array = []; | 484 // array = []; |
485 // if (!done) %concat_iterable_to_array(array, iterator); | 485 // if (!done) %concat_iterable_to_array(array, iterator); |
486 auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone()); | 486 auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone()); |
487 auto array = CreateTempVar(factory()->NewArrayLiteral( | 487 auto array = CreateTempVar(factory()->NewArrayLiteral( |
488 empty_exprs, | 488 empty_exprs, |
489 // Reuse pattern's literal index - it is unused since there is no | 489 // Reuse pattern's literal index - it is unused since there is no |
490 // actual literal allocated. | 490 // actual literal allocated. |
491 node->literal_index(), is_strong(scope()->language_mode()), | 491 node->literal_index(), RelocInfo::kNoPosition)); |
492 RelocInfo::kNoPosition)); | |
493 | 492 |
494 auto arguments = new (zone()) ZoneList<Expression*>(2, zone()); | 493 auto arguments = new (zone()) ZoneList<Expression*>(2, zone()); |
495 arguments->Add(factory()->NewVariableProxy(array), zone()); | 494 arguments->Add(factory()->NewVariableProxy(array), zone()); |
496 arguments->Add(factory()->NewVariableProxy(iterator), zone()); | 495 arguments->Add(factory()->NewVariableProxy(iterator), zone()); |
497 auto spread_into_array_call = | 496 auto spread_into_array_call = |
498 factory()->NewCallRuntime(Context::CONCAT_ITERABLE_TO_ARRAY_INDEX, | 497 factory()->NewCallRuntime(Context::CONCAT_ITERABLE_TO_ARRAY_INDEX, |
499 arguments, RelocInfo::kNoPosition); | 498 arguments, RelocInfo::kNoPosition); |
500 | 499 |
501 auto if_statement = factory()->NewIfStatement( | 500 auto if_statement = factory()->NewIfStatement( |
502 factory()->NewUnaryOperation(Token::NOT, | 501 factory()->NewUnaryOperation(Token::NOT, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 NOT_A_PATTERN(TryFinallyStatement) | 618 NOT_A_PATTERN(TryFinallyStatement) |
620 NOT_A_PATTERN(UnaryOperation) | 619 NOT_A_PATTERN(UnaryOperation) |
621 NOT_A_PATTERN(VariableDeclaration) | 620 NOT_A_PATTERN(VariableDeclaration) |
622 NOT_A_PATTERN(WhileStatement) | 621 NOT_A_PATTERN(WhileStatement) |
623 NOT_A_PATTERN(WithStatement) | 622 NOT_A_PATTERN(WithStatement) |
624 NOT_A_PATTERN(Yield) | 623 NOT_A_PATTERN(Yield) |
625 | 624 |
626 #undef NOT_A_PATTERN | 625 #undef NOT_A_PATTERN |
627 } // namespace internal | 626 } // namespace internal |
628 } // namespace v8 | 627 } // namespace v8 |
OLD | NEW |