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 19 matching lines...) Expand all Loading... |
30 print(1); | 30 print(1); |
31 } | 31 } |
32 print(2); | 32 print(2); |
33 } | 33 } |
34 } | 34 } |
35 """, """ | 35 """, """ |
36 function() { | 36 function() { |
37 L0: | 37 L0: |
38 while (true) | 38 while (true) |
39 while (true) { | 39 while (true) { |
40 while (P.identical(V.foo(true), true)) | 40 while (V.foo(true)) |
41 if (P.identical(V.foo(false), true)) { | 41 if (V.foo(false)) { |
42 P.print(2); | 42 P.print(2); |
43 continue L0; | 43 continue L0; |
44 } | 44 } |
45 P.print(1); | 45 P.print(1); |
46 } | 46 } |
47 }"""), | 47 }"""), |
48 const TestEntry(""" | 48 const TestEntry(""" |
49 foo(a) => a; | 49 foo(a) => a; |
50 | 50 |
51 main() { | 51 main() { |
(...skipping 21 matching lines...) Expand all Loading... |
73 | 73 |
74 main() { | 74 main() { |
75 if (foo(true)) { | 75 if (foo(true)) { |
76 print(1); | 76 print(1); |
77 } else { | 77 } else { |
78 print(2); | 78 print(2); |
79 } | 79 } |
80 print(3); | 80 print(3); |
81 }""", """ | 81 }""", """ |
82 function() { | 82 function() { |
83 P.identical(V.foo(true), true) ? P.print(1) : P.print(2); | 83 V.foo(true) ? P.print(1) : P.print(2); |
84 P.print(3); | 84 P.print(3); |
85 return null; | 85 return null; |
86 }"""), | 86 }"""), |
87 const TestEntry(""" | 87 const TestEntry(""" |
88 foo(a) => a; | 88 foo(a) => a; |
89 | 89 |
90 main() { | 90 main() { |
91 if (foo(true)) { | 91 if (foo(true)) { |
92 print(1); | 92 print(1); |
93 print(1); | 93 print(1); |
94 } else { | 94 } else { |
95 print(2); | 95 print(2); |
96 print(2); | 96 print(2); |
97 } | 97 } |
98 print(3); | 98 print(3); |
99 }""", """ | 99 }""", """ |
100 function() { | 100 function() { |
101 if (P.identical(V.foo(true), true)) { | 101 if (V.foo(true)) { |
102 P.print(1); | 102 P.print(1); |
103 P.print(1); | 103 P.print(1); |
104 } else { | 104 } else { |
105 P.print(2); | 105 P.print(2); |
106 P.print(2); | 106 P.print(2); |
107 } | 107 } |
108 P.print(3); | 108 P.print(3); |
109 return null; | 109 return null; |
110 }"""), | 110 }"""), |
111 const TestEntry(""" | 111 const TestEntry(""" |
(...skipping 19 matching lines...) Expand all Loading... |
131 }""",""" | 131 }""",""" |
132 function() { | 132 function() { |
133 P.identical(V.foo(), true) ? P.print("bad") : P.print("good"); | 133 P.identical(V.foo(), true) ? P.print("bad") : P.print("good"); |
134 return null; | 134 return null; |
135 }"""), | 135 }"""), |
136 ]; | 136 ]; |
137 | 137 |
138 void main() { | 138 void main() { |
139 runTests(tests); | 139 runTests(tests); |
140 } | 140 } |
OLD | NEW |