Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Test that dart2js type inferrer detects dead code. | |
| 6 | |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 class A { | |
| 10 var field; | |
| 11 A(test) { | |
| 12 if (test) { | |
| 13 return; | |
| 14 field = 42; | |
| 15 } else { | |
| 16 field = 54; | |
| 17 } | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 main() { | |
| 22 var a = new A(true); | |
| 23 Expect.throws(() => a.field + 42, (e) => e is NoSuchMethodError); | |
| 24 } | |
| OLD | NEW |