| 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_test.dart'; | 9 import 'js_backend_cps_ir_test.dart'; |
| 10 | 10 |
| 11 const List<TestEntry> tests = const [ | 11 const List<TestEntry> tests = const [ |
| 12 const TestEntry(""" | 12 const TestEntry(""" |
| 13 main() { | 13 main() { |
| 14 while (true); | 14 while (true); |
| 15 } | 15 } |
| 16 """, """ | 16 """, """ |
| 17 function() { | 17 function() { |
| 18 while (true) | 18 while (P.identical(true, true)) |
| 19 ; | 19 ; |
| 20 return null; |
| 20 }"""), | 21 }"""), |
| 21 const TestEntry(""" | 22 const TestEntry(""" |
| 22 foo(a) => a; | 23 foo(a) => a; |
| 23 | 24 |
| 24 main() { | 25 main() { |
| 25 while (true) { | 26 while (true) { |
| 26 l: while (true) { | 27 l: while (true) { |
| 27 while (foo(true)) { | 28 while (foo(true)) { |
| 28 if (foo(false)) break l; | 29 if (foo(false)) break l; |
| 29 } | 30 } |
| 30 print(1); | 31 print(1); |
| 31 } | 32 } |
| 32 print(2); | 33 print(2); |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 """, """ | 36 """, """ |
| 36 function() { | 37 function() { |
| 37 L0: | 38 L2: |
| 38 while (true) | 39 while (P.identical(true, true)) |
| 39 while (true) { | 40 L1: |
| 40 while (P.identical(V.foo(true), true)) | 41 while (true) { |
| 41 if (P.identical(V.foo(false), true)) { | 42 L0: |
| 42 P.print(2); | 43 if (P.identical(true, true)) { |
| 43 continue L0; | 44 while (P.identical(V.foo(true), true)) |
| 44 } | 45 if (!P.identical(V.foo(false), true)) |
| 45 P.print(1); | 46 ; |
| 46 } | 47 else |
| 48 break L0; |
| 49 P.print(1); |
| 50 continue L1; |
| 51 } |
| 52 P.print(2); |
| 53 continue L2; |
| 54 } |
| 55 return null; |
| 47 }"""), | 56 }"""), |
| 48 const TestEntry(""" | 57 const TestEntry(""" |
| 49 foo(a) => a; | 58 foo(a) => a; |
| 50 | 59 |
| 51 main() { | 60 main() { |
| 52 for (int i = 0; foo(true); i = foo(i)) { | 61 for (int i = 0; foo(true); i = foo(i)) { |
| 53 print(1); | 62 print(1); |
| 54 if (foo(false)) break; | 63 if (foo(false)) break; |
| 55 } | 64 } |
| 56 print(2); | 65 print(2); |
| 57 }""", """ | 66 }""", """ |
| 58 function() { | 67 function() { |
| 59 var i; | 68 var i; |
| 60 i = 0; | 69 i = 0; |
| 61 L1: | 70 L3: |
| 62 while (true) { | 71 while (true) { |
| 63 if (P.identical(V.foo(true), true)) { | 72 if (P.identical(V.foo(true), true)) { |
| 64 P.print(1); | 73 P.print(1); |
| 65 if (!P.identical(V.foo(false), true)) { | 74 if (!P.identical(V.foo(false), true)) { |
| 66 i = V.foo(i); | 75 i = V.foo(i); |
| 67 continue L1; | 76 continue L3; |
| 68 } | 77 } |
| 69 } | 78 } |
| 70 P.print(2); | 79 P.print(2); |
| 71 return null; | 80 return null; |
| 72 } | 81 } |
| 73 }"""), | 82 }"""), |
| 74 const TestEntry(""" | 83 const TestEntry(""" |
| 75 foo(a) => a; | 84 foo(a) => a; |
| 76 | 85 |
| 77 main() { | 86 main() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 P.print(1); | 114 P.print(1); |
| 106 P.print(1); | 115 P.print(1); |
| 107 } else { | 116 } else { |
| 108 P.print(2); | 117 P.print(2); |
| 109 P.print(2); | 118 P.print(2); |
| 110 } | 119 } |
| 111 P.print(3); | 120 P.print(3); |
| 112 return null; | 121 return null; |
| 113 }"""), | 122 }"""), |
| 114 ]; | 123 ]; |
| OLD | NEW |