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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const TestEntry(""" | 148 const TestEntry(""" |
149 main() { | 149 main() { |
150 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; | 150 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; |
151 var xit = xs.iterator, yit = ys.iterator; | 151 var xit = xs.iterator, yit = ys.iterator; |
152 while (xit.moveNext() && yit.moveNext()) { | 152 while (xit.moveNext() && yit.moveNext()) { |
153 print(xit.current); | 153 print(xit.current); |
154 print(yit.current); | 154 print(yit.current); |
155 } | 155 } |
156 }""",r""" | 156 }""",r""" |
157 function() { | 157 function() { |
158 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 =
ys.length, i, i1, current, current1; | 158 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 =
ys.length, i = 0, i1 = 0, current, current1; |
159 if ($length !== xs.length) | |
160 H.throwConcurrentModificationError(xs); | |
161 i = 0; | |
162 i1 = 0; | |
163 for (; i < xs.length; i = i + 1, i1 = i1 + 1) { | 159 for (; i < xs.length; i = i + 1, i1 = i1 + 1) { |
164 current = xs[i]; | 160 current = xs[i]; |
165 if (length1 !== ys.length) | 161 if (length1 !== ys.length) |
166 H.throwConcurrentModificationError(ys); | 162 H.throwConcurrentModificationError(ys); |
167 if (!(i1 < ys.length)) | 163 if (!(i1 < ys.length)) |
168 break; | 164 break; |
169 current1 = ys[i1]; | 165 current1 = ys[i1]; |
170 P.print(current); | 166 P.print(current); |
171 P.print(current1); | 167 P.print(current1); |
172 if ($length !== xs.length) | 168 if ($length !== xs.length) |
173 H.throwConcurrentModificationError(xs); | 169 H.throwConcurrentModificationError(xs); |
174 } | 170 } |
175 }"""), | 171 }"""), |
176 ]; | 172 ]; |
177 | 173 |
178 void main() { | 174 void main() { |
179 runTests(tests); | 175 runTests(tests); |
180 } | 176 } |
OLD | NEW |