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

Unified Diff: runtime/vm/parser.cc

Issue 2179903009: Reverting bad fix of issue #26941. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index f5c0f7760cfdfc5479aef8a0938f5efadac8276c..1b7cec334caab0980f4f066e7dbfebee28454909 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -9054,6 +9054,13 @@ 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
@@ -9062,13 +9069,6 @@ 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),
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698