OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Tests of control flow statements. | 5 // Tests of control flow statements. |
6 | 6 |
7 library control_flow_tests; | 7 library control_flow_tests; |
8 | 8 |
9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const TestEntry(""" | 144 const TestEntry(""" |
145 main() { | 145 main() { |
146 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; | 146 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; |
147 var xit = xs.iterator, yit = ys.iterator; | 147 var xit = xs.iterator, yit = ys.iterator; |
148 while (xit.moveNext() && yit.moveNext()) { | 148 while (xit.moveNext() && yit.moveNext()) { |
149 print(xit.current); | 149 print(xit.current); |
150 print(yit.current); | 150 print(yit.current); |
151 } | 151 } |
152 }""",r""" | 152 }""",r""" |
153 function() { | 153 function() { |
154 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 =
ys.length, i, i1, current, current1; | 154 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 =
ys.length, i = 0, i1 = 0, current, current1; |
155 if ($length !== xs.length) | |
156 H.throwConcurrentModificationError(xs); | |
157 i = 0; | |
158 i1 = 0; | |
159 for (; i < xs.length; i = i + 1, i1 = i1 + 1) { | 155 for (; i < xs.length; i = i + 1, i1 = i1 + 1) { |
160 current = xs[i]; | 156 current = xs[i]; |
161 if (length1 !== ys.length) | 157 if (length1 !== ys.length) |
162 H.throwConcurrentModificationError(ys); | 158 H.throwConcurrentModificationError(ys); |
163 if (!(i1 < ys.length)) | 159 if (!(i1 < ys.length)) |
164 break; | 160 break; |
165 current1 = ys[i1]; | 161 current1 = ys[i1]; |
166 P.print(current); | 162 P.print(current); |
167 P.print(current1); | 163 P.print(current1); |
168 if ($length !== xs.length) | 164 if ($length !== xs.length) |
169 H.throwConcurrentModificationError(xs); | 165 H.throwConcurrentModificationError(xs); |
170 } | 166 } |
171 }"""), | 167 }"""), |
172 ]; | 168 ]; |
173 | 169 |
174 void main() { | 170 void main() { |
175 runTests(tests); | 171 runTests(tests); |
176 } | 172 } |
OLD | NEW |