Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 1b7cec334caab0980f4f066e7dbfebee28454909..f5c0f7760cfdfc5479aef8a0938f5efadac8276c 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -9054,13 +9054,6 @@ AstNode* Parser::ParseForInStatement(TokenPosition forin_pos, |
new(Z) StoreLocalNode(collection_pos, iterator_var, get_iterator); |
current_block_->statements->Add(iterator_init); |
- // Generate while loop condition. |
- AstNode* iterator_moveNext = new(Z) InstanceCallNode( |
- collection_pos, |
- new(Z) LoadLocalNode(collection_pos, iterator_var), |
- Symbols::MoveNext(), |
- no_args); |
- |
// Parse the for loop body. Ideally, we would use ParseNestedStatement() |
// here, but that does not work well because we have to insert an implicit |
// variable assignment and potentially a variable declaration in the |
@@ -9069,6 +9062,13 @@ AstNode* Parser::ParseForInStatement(TokenPosition forin_pos, |
current_block_->scope->AddLabel(label); |
const TokenPosition loop_var_assignment_pos = TokenPos(); |
+ // Generate while loop condition. |
+ AstNode* iterator_moveNext = new(Z) InstanceCallNode( |
+ loop_var_assignment_pos, |
+ new(Z) LoadLocalNode(loop_var_assignment_pos, iterator_var), |
+ Symbols::MoveNext(), |
+ no_args); |
+ |
AstNode* iterator_current = new(Z) InstanceGetterNode( |
loop_var_assignment_pos, |
new(Z) LoadLocalNode(loop_var_assignment_pos, iterator_var), |