OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Regression test for issue 21795. | 5 // Regression test for issue 21795. |
6 | 6 |
7 foo(t) { | 7 foo(t) { |
8 try { | 8 try { |
9 if (t == 123) throw 42; | 9 if (t == 123) throw 42; |
10 } finally { } | 10 } finally {} |
11 } | 11 } |
12 | 12 |
13 bar() { | 13 bar() { |
14 try { | 14 try { |
15 return 42; | 15 return 42; |
16 } finally { } | 16 } finally {} |
17 } | 17 } |
18 | 18 |
19 | |
20 class A { | 19 class A { |
21 test(t) { | 20 test(t) { |
22 try { | 21 try { |
23 foo(t); | 22 foo(t); |
24 } finally { | 23 } finally { |
25 if (t == 0) { | 24 if (t == 0) { |
26 try { | 25 try {} catch (err, st) {} |
27 } catch (err, st) { | |
28 } | |
29 } | 26 } |
30 } | 27 } |
31 } | 28 } |
32 } | 29 } |
33 | 30 |
34 | |
35 main() { | 31 main() { |
36 var a = new A(); | 32 var a = new A(); |
37 for (var i=0; i<10000; ++i) a.test(0); | 33 for (var i = 0; i < 10000; ++i) a.test(0); |
38 try { | 34 try { |
39 a.test(123); | 35 a.test(123); |
40 } catch (e, s) { | 36 } catch (e, s) { |
41 if (s.toString().indexOf("foo") == -1) { | 37 if (s.toString().indexOf("foo") == -1) { |
42 print(s); | 38 print(s); |
43 throw "Expected foo in stacktrace!"; | 39 throw "Expected foo in stacktrace!"; |
44 } | 40 } |
45 } | 41 } |
46 } | 42 } |
OLD | NEW |