Chromium Code Reviews| 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 foo() { | 5 foo() { |
| 6 try { | 6 try { |
| 7 throw "hi there"; | 7 throw "hi there"; |
| 8 } on String catch (e, t) { | 8 } on String catch (e, t) { |
| 9 } catch (e, t) { | 9 } catch (e, t) { |
| 10 rethrow; | 10 rethrow; |
| 11 } | 11 } |
| 12 } | 12 } |
| 13 | |
| 13 bar() { | 14 bar() { |
| 14 try { | 15 try { |
| 15 throw "hi there"; | 16 throw "hi there"; |
| 16 } catch (e, t) { | 17 } catch (e, t) { |
| 17 } on String catch (e, t) { | 18 } on String catch (e, t) { |
| 18 // unreachable | 19 // unreachable |
| 19 rethrow; | 20 rethrow; |
| 20 } | 21 } |
| 21 } | 22 } |
| 23 | |
| 24 baz() { | |
| 25 try { | |
| 26 throw "finally only"; | |
| 27 } finally { | |
| 28 return true; | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 qux() { | |
| 33 try { | |
| 34 throw "on only"; | |
|
Jacob
2015/03/27 17:04:30
code that triggers a NPE without the fix.
| |
| 35 } on String catch (e, t) { | |
| 36 // unreachable | |
| 37 rethrow; | |
| 38 } | |
| 39 } | |
| 40 | |
| 22 main() { | 41 main() { |
| 23 foo(); | 42 foo(); |
| 24 bar(); | 43 bar(); |
| 44 baz(); | |
| 45 qux(); | |
| 25 } | 46 } |
| OLD | NEW |