| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 e?.f ??= 200; | 46 e?.f ??= 200; |
| 47 Expect.equals(200, e?.f); | 47 Expect.equals(200, e?.f); |
| 48 | 48 |
| 49 c?.f ??= 400; | 49 c?.f ??= 400; |
| 50 Expect.equals(null, c?.f); | 50 Expect.equals(null, c?.f); |
| 51 Expect.equals(null, c?.f++); | 51 Expect.equals(null, c?.f++); |
| 52 e?.f++; | 52 e?.f++; |
| 53 Expect.equals(201, e.f); | 53 Expect.equals(201, e.f); |
| 54 | 54 |
| 55 var x = 5 ?? bomb(); | 55 var x = 5 ?? bomb(); |
| 56 Expect.equals(5, x); |
| 57 |
| 58 var y; |
| 59 x = y ?? 1; |
| 60 Expect.equals(1, x); |
| 61 Expect.equals(null, y); |
| 56 } | 62 } |
| 57 | 63 |
| 58 // Check that instructions without result do not crash. | 64 // Check that instructions without result do not crash. |
| 59 test2() { | 65 test2() { |
| 60 var c; | 66 var c; |
| 61 c?.v; | 67 c?.v; |
| 62 c?.m(bomb()); | 68 c?.m(bomb()); |
| 63 } | 69 } |
| 64 | 70 |
| 65 main() { | 71 main() { |
| 66 for (int i = 0; i < 10; i++) { | 72 for (int i = 0; i < 10; i++) { |
| 67 test(); | 73 test(); |
| 68 test2(); | 74 test2(); |
| 69 } | 75 } |
| 70 } | 76 } |
| OLD | NEW |