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

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

Issue 1273033007: Fix ??= AST modification (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address review comments 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 | « runtime/vm/parser.cc ('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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698