OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 isCheckedMode() { |
| 6 try { |
| 7 var i = 1; |
| 8 String s = i; |
| 9 return false; |
| 10 } catch (e) { |
| 11 return true; |
| 12 } |
| 13 } |
| 14 |
| 15 int returnString1() => 's'; |
| 16 void returnNull() => null; |
| 17 void returnString2() => 's'; |
| 18 |
| 19 main() { |
| 20 if (isCheckedMode()) { |
| 21 Expect.throws(returnString1, (e) => e is TypeError); |
| 22 Expect.throws(returnString2, (e) => e is TypeError); |
| 23 returnNull(); |
| 24 } else { |
| 25 returnString1(); |
| 26 returnNull(); |
| 27 returnString2(); |
| 28 } |
| 29 } |
OLD | NEW |