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

Unified Diff: runtime/vm/parser.cc

Issue 2188763003: Set correct token position in moveNext call of for-in loops (fixes #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 | no next file » | 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 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),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698