 Chromium Code Reviews
 Chromium Code Reviews Issue 2637403008:
  [async-iteration] add support for for-await-of loops in Async Functions  (Closed)
    
  
    Issue 2637403008:
  [async-iteration] add support for for-await-of loops in Async Functions  (Closed) 
  | Index: src/parsing/pattern-rewriter.cc | 
| diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc | 
| index 6d2ed3d8bb05af405030c8211b708fab7d52cc94..b4312a2a302e5418b24a64331fae7053ed0f088a 100644 | 
| --- a/src/parsing/pattern-rewriter.cc | 
| +++ b/src/parsing/pattern-rewriter.cc | 
| @@ -430,8 +430,9 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, | 
| DCHECK(block_->ignore_completion_value()); | 
| auto temp = *temp_var = CreateTempVar(current_value_); | 
| - auto iterator = CreateTempVar(factory()->NewGetIterator( | 
| - factory()->NewVariableProxy(temp), kNoSourcePosition)); | 
| + auto iterator = CreateTempVar( | 
| + factory()->NewGetIterator(factory()->NewVariableProxy(temp), | 
| + IteratorType::kNormal, kNoSourcePosition)); | 
| 
marja
2017/02/14 09:30:43
Nit: would it make sense to add default params to
 
caitp
2017/02/14 14:16:37
I felt it was better to be explicit about the type
 | 
| auto done = | 
| CreateTempVar(factory()->NewBooleanLiteral(false, kNoSourcePosition)); | 
| auto result = CreateTempVar(); | 
| @@ -517,7 +518,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, | 
| factory()->NewExpressionStatement( | 
| parser_->BuildIteratorNextResult( | 
| factory()->NewVariableProxy(iterator), result, | 
| - kNoSourcePosition), | 
| + IteratorType::kNormal, kNoSourcePosition), | 
| kNoSourcePosition), | 
| zone()); | 
| next_block->statements()->Add(inner_if, zone()); | 
| @@ -588,7 +589,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, | 
| // result = IteratorNext(iterator); | 
| Statement* get_next = factory()->NewExpressionStatement( | 
| parser_->BuildIteratorNextResult(factory()->NewVariableProxy(iterator), | 
| - result, nopos), | 
| + result, IteratorType::kNormal, nopos), | 
| nopos); | 
| // %AppendElement(array, result.value); | 
| @@ -657,7 +658,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, | 
| Token::NOT, factory()->NewVariableProxy(done), nopos); | 
| parser_->FinalizeIteratorUse(scope(), completion, closing_condition, iterator, | 
| - block_, target); | 
| + block_, target, IteratorType::kNormal); | 
| block_ = target; | 
| } |