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

Unified Diff: runtime/vm/parser.cc

Issue 1012933002: Fix do-while with await in condition (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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/regress_22777_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 44511)
+++ runtime/vm/parser.cc (working copy)
@@ -8157,12 +8157,15 @@
ExpectToken(Token::kWHILE);
ExpectToken(Token::kLPAREN);
SequenceNode* await_preamble = NULL;
- AstNode* cond_expr = ParseAwaitableExpr(
- kAllowConst, kConsumeCascades, &await_preamble);
- // No need for special handling of the await preamble as we can just append o
- // it to the loop body.
+ intptr_t expr_pos = TokenPos();
+ AstNode* cond_expr =
+ ParseAwaitableExpr(kAllowConst, kConsumeCascades, &await_preamble);
if (await_preamble != NULL) {
- dowhile_body->Add(await_preamble);
+ // Prepend the preamble to the condition.
+ LetNode* await_cond = new(Z) LetNode(expr_pos);
+ await_cond->AddNode(await_preamble);
+ await_cond->AddNode(cond_expr);
+ cond_expr = await_cond;
}
ExpectToken(Token::kRPAREN);
ExpectSemicolon();
« no previous file with comments | « no previous file | tests/language/regress_22777_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698