OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Dart test program to test check that we don't fail to compile when an | 5 // Dart test program to test check that we don't fail to compile when an |
6 // inlinable method contains a throw. | 6 // inlinable method contains a throw. |
7 | 7 |
8 var x = false; | 8 var x = false; |
9 | 9 |
10 bool called; | 10 bool called; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 yo() { | 71 yo() { |
72 throw kast("yo"); | 72 throw kast("yo"); |
73 } | 73 } |
74 hoo() { | 74 hoo() { |
75 x[kast("hoo")] = 0; | 75 x[kast("hoo")] = 0; |
76 x[kast("hoo")]; | 76 x[kast("hoo")]; |
77 kast("hoo").x = 0; | 77 kast("hoo").x = 0; |
78 kast("hoo").x; | 78 kast("hoo").x; |
79 } | 79 } |
80 | 80 |
81 switcheroo(x) { | 81 switcheroo() { |
82 switch (kast("switcheroo")) { | 82 switch (kast("switcheroo")) { |
83 case 0: | 83 case 0: |
84 boo(); | 84 boo(); |
85 } | 85 } |
86 } | 86 } |
87 switchertoo(x) { | |
88 switch (kast("switcheroo")) { | |
89 case boo(): | |
90 foo(); | |
91 } | |
92 } | |
93 | |
94 switchenoo(x) { | |
95 switch (x) { | |
96 case callMeTrue(): | |
97 break; | |
98 case kast("switchenoo"): | |
99 break; | |
100 case 42: | |
101 return 42; | |
102 } | |
103 } | |
104 | 87 |
105 interpole() => "inter${kast('tada!')}pole"; | 88 interpole() => "inter${kast('tada!')}pole"; |
106 interpoleCallThrow() => "inter${callMeTrue()}...${kast('tada!')}pole"; | 89 interpoleCallThrow() => "inter${callMeTrue()}...${kast('tada!')}pole"; |
107 | 90 |
108 call1() => ternary(0, kast("call1"), 1); | 91 call1() => ternary(0, kast("call1"), 1); |
109 call2() => ternary(kast("call2"), 0, 1); | 92 call2() => ternary(kast("call2"), 0, 1); |
110 call3() => ternary(0, 1, kast("call3")); | 93 call3() => ternary(0, 1, kast("call3")); |
111 call1c() => ternary(callMe(), kast("call1"), 1); | 94 call1c() => ternary(callMe(), kast("call1"), 1); |
112 call3c() => ternary(callMeTrue(), 1, kast("call3")); | 95 call3c() => ternary(callMeTrue(), 1, kast("call3")); |
113 call4c() => ternary(0, callMeTrue(), kast("call3")); | 96 call4c() => ternary(0, callMeTrue(), kast("call3")); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Expect.throws(() => fizz(false)); | 154 Expect.throws(() => fizz(false)); |
172 testCall(fizzc); | 155 testCall(fizzc); |
173 testCallThenThrow(fizzCallThrow); | 156 testCallThenThrow(fizzCallThrow); |
174 Expect.throws(fuzz); | 157 Expect.throws(fuzz); |
175 Expect.throws(farce); | 158 Expect.throws(farce); |
176 Expect.throws(unary); | 159 Expect.throws(unary); |
177 testCallThenThrow(boo); | 160 testCallThenThrow(boo); |
178 Expect.throws(yo); | 161 Expect.throws(yo); |
179 Expect.throws(hoo); | 162 Expect.throws(hoo); |
180 Expect.throws(switcheroo); | 163 Expect.throws(switcheroo); |
181 Expect.throws(switchertoo); | |
182 testCallThenThrow(() => switchenoo(false)); | |
183 switchenoo(true); | |
184 testCall(() { try { switchenoo(x); } catch(e) { } }); | |
185 Expect.throws(interpole); | 164 Expect.throws(interpole); |
186 testCallThenThrow(interpoleCallThrow); | 165 testCallThenThrow(interpoleCallThrow); |
187 Expect.throws(call1); | 166 Expect.throws(call1); |
188 Expect.throws(call2); | 167 Expect.throws(call2); |
189 Expect.throws(call3); | 168 Expect.throws(call3); |
190 testCallThenThrow(call1c); | 169 testCallThenThrow(call1c); |
191 testCallThenThrow(call3c); | 170 testCallThenThrow(call3c); |
192 testCallThenThrow(call4c); | 171 testCallThenThrow(call4c); |
193 Expect.throws(sendSet); | 172 Expect.throws(sendSet); |
194 testCallThenThrow(sendSetCallThrow); | 173 testCallThenThrow(sendSetCallThrow); |
195 Expect.throws(isSend); | 174 Expect.throws(isSend); |
196 testNoThrow(vile); | 175 testNoThrow(vile); |
197 testCallThenThrow(dovile); | 176 testCallThenThrow(dovile); |
198 testCall(dovileBreak); | 177 testCall(dovileBreak); |
199 testCallThenThrow(dovileContinue); | 178 testCallThenThrow(dovileContinue); |
200 } | 179 } |
OLD | NEW |