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 // VMOptions=--optimization_counter_threshold=5 | 5 // VMOptions=--optimization_counter_threshold=5 |
6 // | 6 // |
7 // Basic null-aware operator test that invokes the optimizing compiler. | 7 // Basic null-aware operator test that invokes the optimizing compiler. |
8 | 8 |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 var x = 5 ?? bomb(); | 61 var x = 5 ?? bomb(); |
62 } | 62 } |
63 | 63 |
64 // Check that instructions without result do not crash. | 64 // Check that instructions without result do not crash. |
65 test2() { | 65 test2() { |
66 var c; | 66 var c; |
67 c?.v; | 67 c?.v; |
68 c?.m(bomb()); | 68 c?.m(bomb()); |
69 } | 69 } |
70 | 70 |
| 71 class Bar { |
| 72 String s; |
| 73 } |
| 74 |
| 75 class Foo { |
| 76 Bar _bar; |
| 77 String str; |
| 78 |
| 79 Foo(this._bar) : str = _bar?.s; |
| 80 } |
| 81 |
71 main() { | 82 main() { |
72 for (int i = 0; i < 10; i++) { | 83 for (int i = 0; i < 10; i++) { |
73 test(); | 84 test(); |
74 test2(); | 85 test2(); |
75 } | 86 } |
| 87 |
| 88 Expect.equals(null, new Foo(new Bar()).str); |
76 } | 89 } |
OLD | NEW |