| 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 14 matching lines...) Expand all  Loading... | 
| 25   var c; | 25   var c; | 
| 26   var d = new C(5); | 26   var d = new C(5); | 
| 27   Expect.equals(null, c?.m(bomb())); | 27   Expect.equals(null, c?.m(bomb())); | 
| 28   Expect.equals(null, getNull()?.anything(bomb())); | 28   Expect.equals(null, getNull()?.anything(bomb())); | 
| 29   Expect.equals(1, d?.m(1)); | 29   Expect.equals(1, d?.m(1)); | 
| 30 | 30 | 
| 31   Expect.equals(1, new C(1)?.f); | 31   Expect.equals(1, new C(1)?.f); | 
| 32   Expect.equals(null, c?.v); | 32   Expect.equals(null, c?.v); | 
| 33   Expect.equals(10, c ?? 10); | 33   Expect.equals(10, c ?? 10); | 
| 34   Expect.equals(d, d ?? bomb()); | 34   Expect.equals(d, d ?? bomb()); | 
|  | 35   Expect.equals(3, [[3]]?.expand((i) => i).toList()[0]); | 
|  | 36   Expect.equals(null, (null as List<List<int>>)?.expand((i) => i)?.toList()); | 
| 35 | 37 | 
| 36   var e; | 38   var e; | 
| 37   // The assignment to e is not executed since d != null. | 39   // The assignment to e is not executed since d != null. | 
| 38   d ??= e ??= new C(100); | 40   d ??= e ??= new C(100); | 
| 39   Expect.equals(null, e); | 41   Expect.equals(null, e); | 
| 40   e ??= new C(100); | 42   e ??= new C(100); | 
| 41   Expect.equals(100, e?.f); | 43   Expect.equals(100, e?.f); | 
| 42   e?.f ??= 200; | 44   e?.f ??= 200; | 
| 43   Expect.equals(100, e?.f); | 45   Expect.equals(100, e?.f); | 
| 44 | 46 | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 61   c?.v; | 63   c?.v; | 
| 62   c?.m(bomb()); | 64   c?.m(bomb()); | 
| 63 } | 65 } | 
| 64 | 66 | 
| 65 main() { | 67 main() { | 
| 66   for (int i = 0; i < 10; i++) { | 68   for (int i = 0; i < 10; i++) { | 
| 67     test(); | 69     test(); | 
| 68     test2(); | 70     test2(); | 
| 69   } | 71   } | 
| 70 } | 72 } | 
| OLD | NEW | 
|---|