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

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

Issue 1511293003: Use annotations on confuse() in null_test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Second dart test program. 4 // Second dart test program.
5 5
6 // VMOptions=--optimization-counter-threshold=5 6 // VMOptions=--optimization-counter-threshold=5
7 7
8 import "dart:mirrors"; 8 import "dart:mirrors";
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 class Generic2<T, S> { 30 class Generic2<T, S> {
31 bool test(o) => new Generic<T>().test(o); 31 bool test(o) => new Generic<T>().test(o);
32 T cast(o) => new Generic<T>().cast(o); 32 T cast(o) => new Generic<T>().cast(o);
33 Type get type => new Generic<T>().type; 33 Type get type => new Generic<T>().type;
34 } 34 }
35 35
36 // Magic incantation to avoid the compiler recognizing the constant values 36 // Magic incantation to avoid the compiler recognizing the constant values
37 // at compile time. If the result is computed at compile time, the dynamic code 37 // at compile time. If the result is computed at compile time, the dynamic code
38 // will not be tested. 38 // will not be tested.
39 confuse(x) { 39 @NoInline()
40 try { 40 @AssumeDynamic()
41 if (new DateTime.now().millisecondsSinceEpoch == 42) x = 42; 41 confuse(x) => x;
42 throw [x];
43 } on dynamic catch (e) { return e[0]; }
44 return 42;
45 }
46 42
47 void main() { 43 void main() {
48 for (int i = 0; i < 10; i++) { 44 for (int i = 0; i < 10; i++) {
49 test(); 45 test();
50 } 46 }
51 } 47 }
52 48
53 void test() { 49 void test() {
54 new BadInherit(); // Make sure class is referenced. 50 new BadInherit(); // Make sure class is referenced.
55 51
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 var capture = new CaptureInvocationMirror(); 194 var capture = new CaptureInvocationMirror();
199 var mirror = capture.notDeclared(); 195 var mirror = capture.notDeclared();
200 Expect.throws(() => noSuchMethod(mirror)); 196 Expect.throws(() => noSuchMethod(mirror));
201 Expect.throws(() => Function.apply(noSuchMethod, [mirror])); 197 Expect.throws(() => Function.apply(noSuchMethod, [mirror]));
202 } 198 }
203 199
204 200
205 class CaptureInvocationMirror { 201 class CaptureInvocationMirror {
206 noSuchMethod(mirror) => mirror; 202 noSuchMethod(mirror) => mirror;
207 } 203 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698