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

Unified Diff: tests/language/await_postfix_expr_test.dart

Issue 1017753003: Fix issue 22875 (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 | « runtime/vm/ast_transformer.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_postfix_expr_test.dart
===================================================================
--- tests/language/await_postfix_expr_test.dart (revision 44546)
+++ tests/language/await_postfix_expr_test.dart (working copy)
@@ -31,12 +31,24 @@
return s;
}
+// Adapted from repro case for issue 22875.
+sum2(n) async {
+ int i, s = 0;
+ for (i = 1; i <= n; await i++) {
+ // The loop-local variable j was necessary for the crash in 22785.
+ var j = await i;
+ s += j;
+ }
+ return s;
+}
+
test() async {
Expect.equals(10, await post0(10));
Expect.equals(21, await post1(10));
Expect.equals(11, await pref0(10));
Expect.equals(23, await pref1(10));
Expect.equals(10, await sum([1, 2, 3, 4]));
+ Expect.equals(10, await sum2(4));
}
main() {
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698