Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: tests/language/nullaware_opt_test.dart

Issue 1255293005: Fix analyzer interpretation of 'ClassName?.staticMember'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 class C { 11 class C {
12 C(this.f); 12 C(this.f);
13 var f; 13 var f;
14 m(a) => a; 14 m(a) => a;
15 } 15 }
16 16
17 bomb() { 17 bomb() {
18 Expect.fail('Should not be executed'); 18 Expect.fail('Should not be executed');
19 return 100; 19 return 100;
20 } 20 }
21 21
22 getNull() => null; 22 getNull() => null;
23 23
24 test() { 24 test() {
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 Expect.equals("C", C?.toString());
31 30
32 Expect.equals(1, new C(1)?.f); 31 Expect.equals(1, new C(1)?.f);
33 Expect.equals(null, c?.v); 32 Expect.equals(null, c?.v);
34 Expect.equals(10, c ?? 10); 33 Expect.equals(10, c ?? 10);
35 Expect.equals(d, d ?? bomb()); 34 Expect.equals(d, d ?? bomb());
36 35
37 var e; 36 var e;
38 // The assignment to e is not executed since d != null. 37 // The assignment to e is not executed since d != null.
39 d ??= e ??= new C(100); 38 d ??= e ??= new C(100);
40 Expect.equals(null, e); 39 Expect.equals(null, e);
(...skipping 21 matching lines...) Expand all
62 c?.v; 61 c?.v;
63 c?.m(bomb()); 62 c?.m(bomb());
64 } 63 }
65 64
66 main() { 65 main() {
67 for (int i = 0; i < 10; i++) { 66 for (int i = 0; i < 10; i++) {
68 test(); 67 test();
69 test2(); 68 test2();
70 } 69 }
71 } 70 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698