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

Unified Diff: tests/language/await_future_test.dart

Issue 538803002: Enable await in for and for-in loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/await_future_test.dart
diff --git a/tests/language/await_future_test.dart b/tests/language/await_future_test.dart
index 2652d1d5b956737b89cbbb8d5c78e1f2453b5212..fdaaf7b4d3a099efcb99afcef5e877cf8dcef808 100644
--- a/tests/language/await_future_test.dart
+++ b/tests/language/await_future_test.dart
@@ -154,6 +154,27 @@ awaitNestedDoWhile(int i, int j) async {
return k;
}
+awaitFor() async {
+ var asyncInc = (p) async => p+1;
+ var k = 0;
+ for (int j = (await bar(0)), i = (await bar(1));
+ j < (await bar(5));
+ j = (await asyncInc(j)), i = (await asyncInc(i))) {
+ k += i;
+ k += j;
+ }
+ return k;
+}
+
+awaitForIn() async {
+ var list = ['a', 'b', 'c'];
+ var k = '';
+ for (var c in (await bar(list))) {
+ k += c;
+ }
+ return k;
+}
+
main() async {
var result;
for (int i = 0; i < 10; i++) {
@@ -189,5 +210,9 @@ main() async {
Expect.equals(15, result);
result = await awaitNestedWhile(4,6);
Expect.equals(24, result);
+ result = await awaitFor();
+ Expect.equals(25, result);
+ result = await awaitForIn();
+ Expect.equals('abc', result);
}
}
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698