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

Unified Diff: tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart

Issue 1234753003: dart2js cps: Rewrite mutable variables to continuation parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add tests and fix an assertion Created 5 years, 5 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/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart
index adf8db795e4c5e1608161a4f0f19bb9a454efaf2..e777044647acccb73e09770b0bb2c6d28a0c0b81 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart
@@ -127,6 +127,52 @@ function() {
V.foo();
P.print("good");
}"""),
+ const TestEntry("""
+main() {
+ var list = [1,2,3,4,5,6];
+ for (var x in list) {
+ print(x);
+ }
+}""",r"""
+function() {
+ var list = [1, 2, 3, 4, 5, 6], $length = list.length, i = 0;
+ while (i < list.length) {
+ P.print(list[i]);
+ if ($length !== list.length)
+ H.throwConcurrentModificationError(list);
+ i = i + 1;
+ }
+}"""),
+ const TestEntry("""
+main() {
+ var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C'];
+ var xit = xs.iterator, yit = ys.iterator;
+ while (xit.moveNext() && yit.moveNext()) {
+ print(xit.current);
+ print(yit.current);
+ }
+}""",r"""
+function() {
+ var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 = ys.length, i, i1, current, current1;
+ if ($length !== xs.length)
+ H.throwConcurrentModificationError(xs);
+ i = 0;
+ i1 = 0;
+ while (i < xs.length) {
+ current = xs[i];
+ if (length1 !== ys.length)
+ H.throwConcurrentModificationError(ys);
+ if (!(i1 < ys.length))
+ break;
+ current1 = ys[i1];
+ P.print(current);
+ P.print(current1);
+ if ($length !== xs.length)
+ H.throwConcurrentModificationError(xs);
+ i = i + 1;
+ i1 = i1 + 1;
+ }
+}"""),
];
void main() {
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698