| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 P.print("good"); | 131 P.print("good"); |
| 132 }"""), | 132 }"""), |
| 133 const TestEntry(""" | 133 const TestEntry(""" |
| 134 main() { | 134 main() { |
| 135 var list = [1,2,3,4,5,6]; | 135 var list = [1,2,3,4,5,6]; |
| 136 for (var x in list) { | 136 for (var x in list) { |
| 137 print(x); | 137 print(x); |
| 138 } | 138 } |
| 139 }""",r""" | 139 }""",r""" |
| 140 function() { | 140 function() { |
| 141 var list = [1, 2, 3, 4, 5, 6], $length = list.length, i = 0; | 141 var list = [1, 2, 3, 4, 5, 6], i = 0; |
| 142 for (; i < list.length; i = i + 1) { | 142 for (; i < 6; i = i + 1) |
| 143 P.print(list[i]); | 143 P.print(list[i]); |
| 144 if ($length !== list.length) | |
| 145 H.throwConcurrentModificationError(list); | |
| 146 } | |
| 147 }"""), | 144 }"""), |
| 148 const TestEntry(""" | 145 const TestEntry(""" |
| 149 main() { | 146 main() { |
| 150 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; | 147 var xs = ['x', 'y', 'z'], ys = ['A', 'B', 'C']; |
| 151 var xit = xs.iterator, yit = ys.iterator; | 148 var xit = xs.iterator, yit = ys.iterator; |
| 152 while (xit.moveNext() && yit.moveNext()) { | 149 while (xit.moveNext() && yit.moveNext()) { |
| 153 print(xit.current); | 150 print(xit.current); |
| 154 print(yit.current); | 151 print(yit.current); |
| 155 } | 152 } |
| 156 }""",r""" | 153 }""",r""" |
| 157 function() { | 154 function() { |
| 158 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], $length = xs.length, length1 =
ys.length, i = 0, i1 = 0, current, current1; | 155 var xs = ["x", "y", "z"], ys = ["A", "B", "C"], i = 0, i1 = 0, current, curren
t1; |
| 159 for (; i < xs.length; i = i + 1, i1 = i1 + 1) { | 156 for (; i < 3; i = i + 1, i1 = i1 + 1) { |
| 160 current = xs[i]; | 157 current = xs[i]; |
| 161 if (length1 !== ys.length) | 158 if (!(i1 < 3)) |
| 162 H.throwConcurrentModificationError(ys); | |
| 163 if (!(i1 < ys.length)) | |
| 164 break; | 159 break; |
| 165 current1 = ys[i1]; | 160 current1 = ys[i1]; |
| 166 P.print(current); | 161 P.print(current); |
| 167 P.print(current1); | 162 P.print(current1); |
| 168 if ($length !== xs.length) | |
| 169 H.throwConcurrentModificationError(xs); | |
| 170 } | 163 } |
| 171 }"""), | 164 }"""), |
| 172 ]; | 165 ]; |
| 173 | 166 |
| 174 void main() { | 167 void main() { |
| 175 runTests(tests); | 168 runTests(tests); |
| 176 } | 169 } |
| OLD | NEW |