| 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 // SharedOptions=--enable-null-aware-operators | 5 // SharedOptions=--enable-null-aware-operators |
| 6 // VMOptions=--optimization_counter_threshold=5 | 6 // VMOptions=--optimization_counter_threshold=5 |
| 7 // | 7 // |
| 8 // Basic null-aware operator test that invokes the optimizing compiler. | 8 // Basic null-aware operator test that invokes the optimizing compiler. |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 c?.f ??= 400; | 51 c?.f ??= 400; |
| 52 Expect.equals(null, c?.f); | 52 Expect.equals(null, c?.f); |
| 53 Expect.equals(null, c?.f++); | 53 Expect.equals(null, c?.f++); |
| 54 e?.f++; | 54 e?.f++; |
| 55 Expect.equals(201, e.f); | 55 Expect.equals(201, e.f); |
| 56 | 56 |
| 57 var x = 5 ?? bomb(); | 57 var x = 5 ?? bomb(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Check that instructions without result do not crash. |
| 61 test2() { |
| 62 var c; |
| 63 c?.v; |
| 64 c?.m(bomb()); |
| 65 } |
| 66 |
| 60 main() { | 67 main() { |
| 61 for (int i = 0; i < 10; i++) { | 68 for (int i = 0; i < 10; i++) { |
| 62 test(); | 69 test(); |
| 70 test2(); |
| 63 } | 71 } |
| 64 } | 72 } |
| OLD | NEW |