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

Unified Diff: pkg/kernel/testcases/closures/syncstar.dart

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Comments. Created 3 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 | « pkg/kernel/testcases/closures/loop2.dart.expect ('k') | pkg/kernel/testcases/closures/syncstar.dart.expect » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/testcases/closures/syncstar.dart
diff --git a/pkg/kernel/testcases/closures/syncstar.dart b/pkg/kernel/testcases/closures/syncstar.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9dd0543f42d3d54d0f3db8f87441e1c48ec7433b
--- /dev/null
+++ b/pkg/kernel/testcases/closures/syncstar.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// This tests that the wrapper function around converted closures in the VM
+// doesn't break when the context parameter is captured (since async
+// transformations introduces an additional closure here).
+
+range(int high) {
+ iter(int low) sync* {
+ while (high-- > low) yield high;
+ }
+
+ return iter;
+}
+
+main() {
+ var sum = 0;
+ for (var x in range(10)(2)) sum += x;
+
+ if (sum != 44) {
+ throw new Exception("Incorrect output.");
+ }
+}
« no previous file with comments | « pkg/kernel/testcases/closures/loop2.dart.expect ('k') | pkg/kernel/testcases/closures/syncstar.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698