Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1064)

Side by Side Diff: src/parsing/pattern-rewriter.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/parsing/parameter-initializer-rewriter.h" 8 #include "src/parsing/parameter-initializer-rewriter.h"
9 #include "src/parsing/parser.h" 9 #include "src/parsing/parser.h"
10 10
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 factory()->NewExpressionStatement( 441 factory()->NewExpressionStatement(
442 factory()->NewAssignment( 442 factory()->NewAssignment(
443 Token::ASSIGN, factory()->NewVariableProxy(done), 443 Token::ASSIGN, factory()->NewVariableProxy(done),
444 factory()->NewBooleanLiteral(true, nopos), nopos), 444 factory()->NewBooleanLiteral(true, nopos), nopos),
445 nopos), 445 nopos),
446 zone()); 446 zone());
447 next_block->statements()->Add( 447 next_block->statements()->Add(
448 factory()->NewExpressionStatement( 448 factory()->NewExpressionStatement(
449 parser_->BuildIteratorNextResult( 449 parser_->BuildIteratorNextResult(
450 factory()->NewVariableProxy(iterator), result, 450 factory()->NewVariableProxy(iterator), result,
451 kNoSourcePosition), 451 IteratorType::kNormal, kNoSourcePosition),
452 kNoSourcePosition), 452 kNoSourcePosition),
453 zone()); 453 zone());
454 next_block->statements()->Add(inner_if, zone()); 454 next_block->statements()->Add(inner_if, zone());
455 455
456 if_not_done = factory()->NewIfStatement( 456 if_not_done = factory()->NewIfStatement(
457 factory()->NewUnaryOperation( 457 factory()->NewUnaryOperation(
458 Token::NOT, factory()->NewVariableProxy(done), kNoSourcePosition), 458 Token::NOT, factory()->NewVariableProxy(done), kNoSourcePosition),
459 next_block, factory()->NewEmptyStatement(kNoSourcePosition), 459 next_block, factory()->NewEmptyStatement(kNoSourcePosition),
460 kNoSourcePosition); 460 kNoSourcePosition);
461 } 461 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // done = true; 515 // done = true;
516 Statement* set_done = factory()->NewExpressionStatement( 516 Statement* set_done = factory()->NewExpressionStatement(
517 factory()->NewAssignment( 517 factory()->NewAssignment(
518 Token::ASSIGN, factory()->NewVariableProxy(done), 518 Token::ASSIGN, factory()->NewVariableProxy(done),
519 factory()->NewBooleanLiteral(true, nopos), nopos), 519 factory()->NewBooleanLiteral(true, nopos), nopos),
520 nopos); 520 nopos);
521 521
522 // result = IteratorNext(iterator); 522 // result = IteratorNext(iterator);
523 Statement* get_next = factory()->NewExpressionStatement( 523 Statement* get_next = factory()->NewExpressionStatement(
524 parser_->BuildIteratorNextResult(factory()->NewVariableProxy(iterator), 524 parser_->BuildIteratorNextResult(factory()->NewVariableProxy(iterator),
525 result, nopos), 525 result, IteratorType::kNormal, nopos),
526 nopos); 526 nopos);
527 527
528 // %AppendElement(array, result.value); 528 // %AppendElement(array, result.value);
529 Statement* append_element; 529 Statement* append_element;
530 { 530 {
531 auto args = new (zone()) ZoneList<Expression*>(2, zone()); 531 auto args = new (zone()) ZoneList<Expression*>(2, zone());
532 args->Add(factory()->NewVariableProxy(array), zone()); 532 args->Add(factory()->NewVariableProxy(array), zone());
533 args->Add(factory()->NewProperty( 533 args->Add(factory()->NewProperty(
534 factory()->NewVariableProxy(result), 534 factory()->NewVariableProxy(result),
535 factory()->NewStringLiteral( 535 factory()->NewStringLiteral(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 block_->statements()->Add(loop, zone()); 585 block_->statements()->Add(loop, zone());
586 RecurseIntoSubpattern(spread->expression(), 586 RecurseIntoSubpattern(spread->expression(),
587 factory()->NewVariableProxy(array)); 587 factory()->NewVariableProxy(array));
588 } 588 }
589 589
590 Expression* closing_condition = factory()->NewUnaryOperation( 590 Expression* closing_condition = factory()->NewUnaryOperation(
591 Token::NOT, factory()->NewVariableProxy(done), nopos); 591 Token::NOT, factory()->NewVariableProxy(done), nopos);
592 592
593 parser_->FinalizeIteratorUse(scope(), completion, closing_condition, iterator, 593 parser_->FinalizeIteratorUse(scope(), completion, closing_condition, iterator,
594 block_, target); 594 block_, target, IteratorType::kNormal);
595 block_ = target; 595 block_ = target;
596 } 596 }
597 597
598 598
599 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { 599 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) {
600 Variable* temp_var = nullptr; 600 Variable* temp_var = nullptr;
601 VisitArrayLiteral(node, &temp_var); 601 VisitArrayLiteral(node, &temp_var);
602 } 602 }
603 603
604 604
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 NOT_A_PATTERN(TryFinallyStatement) 692 NOT_A_PATTERN(TryFinallyStatement)
693 NOT_A_PATTERN(UnaryOperation) 693 NOT_A_PATTERN(UnaryOperation)
694 NOT_A_PATTERN(VariableDeclaration) 694 NOT_A_PATTERN(VariableDeclaration)
695 NOT_A_PATTERN(WhileStatement) 695 NOT_A_PATTERN(WhileStatement)
696 NOT_A_PATTERN(WithStatement) 696 NOT_A_PATTERN(WithStatement)
697 NOT_A_PATTERN(Yield) 697 NOT_A_PATTERN(Yield)
698 698
699 #undef NOT_A_PATTERN 699 #undef NOT_A_PATTERN
700 } // namespace internal 700 } // namespace internal
701 } // namespace v8 701 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698