Chromium Code Reviews| 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 // Check that calling a constructor of a class that cannot be resolved causes | |
| 6 // a runtime error. | |
| 7 | |
| 8 never() => false; | |
|
ngeoffray
2012/08/24 15:43:48
This will be inlined and the code below line 12 wi
karlklose
2012/08/28 09:09:15
Done.
| |
| 9 | |
| 10 main() { | |
| 11 if (never()) { | |
| 12 // These should not produce errors because the calls are never executed. | |
| 13 new A(); /// 01: static type warning | |
| 14 new A.foo(); /// 02: static type warning | |
| 15 new library.A(); /// 03: static type warning | |
| 16 } | |
| 17 | |
| 18 new A(); /// 04: runtime error | |
| 19 new A.foo(); /// 05: runtime error | |
| 20 new library.A(); /// 06: runtime error | |
| 21 try { /// 07: runtime error | |
| 22 new A(); /// 07: continued | |
| 23 } catch (e) { /// 07: continued | |
| 24 } /// 07: continued | |
| 25 } | |
| OLD | NEW |