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

Unified Diff: runtime/vm/parser.cc

Issue 2201203002: Eliminate remaining case of ambiguous context level info (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 d11536b775f48a4432b98e5783fd348e6293a117..fc3e0f9e395538777ae56104cce2d67bf298a1ee 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -8724,16 +8724,20 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) {
// Parse stream expression.
ExpectToken(Token::kIN);
+
+ // Open a block for the iterator variable and the try-finally statement
+ // that contains the loop. Ensure that the block starts at a different
+ // token position than the following loop block. Both blocks can allocate
+ // contexts and if they have a matching token position range,
+ // it can be an issue (cf. bug 26941).
+ OpenBlock();
+ const Block* await_for_block = current_block_;
+
const TokenPosition stream_expr_pos = TokenPos();
AstNode* stream_expr =
ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
ExpectToken(Token::kRPAREN);
- // Open a block for the iterator variable and the try-finally
- // statement that contains the loop.
- OpenBlock();
- const Block* loop_block = current_block_;
-
// Build creation of implicit StreamIterator.
// var :for-in-iter = new StreamIterator(stream_expr).
const Class& stream_iterator_cls =
@@ -8983,8 +8987,8 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) {
try_index,
finally_clause);
- ASSERT(current_block_ == loop_block);
- loop_block->statements->Add(try_catch_node);
+ ASSERT(current_block_ == await_for_block);
+ await_for_block->statements->Add(try_catch_node);
return CloseBlock(); // Implicit block around while loop.
}
« 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