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

Side by Side Diff: tests/compiler/dart2js_extra/bailout_on_continue_test.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class A { 5 class A {
6 operator+(arg) => 42; 6 operator+(arg) => 42;
7 } 7 }
8 8
9 get42() => 42; 9 get42() => 42;
10 getNonInt() => new A(); 10 getNonInt() => new A();
11 use(x) => x; 11 use(x) => x;
12 12
13 void testInWhileLoop() { 13 void testInWhileLoop() {
14 var c = get42(); 14 var c = get42();
15 int index = 0; 15 int index = 0;
16 while (index++ != 2) { 16 while (index++ != 2) {
17 var e = getNonInt(); 17 var e = getNonInt();
18 Expect.equals(42, e + 2); 18 Expect.equals(42, e + 2);
19 if (e !== null) continue; 19 if (e != null) continue;
20 while (true) use(e); 20 while (true) use(e);
21 } 21 }
22 // 'c' must have been saved in the environment. 22 // 'c' must have been saved in the environment.
23 Expect.equals(c, 42); 23 Expect.equals(c, 42);
24 } 24 }
25 25
26 void testInNestedWhileLoop() { 26 void testInNestedWhileLoop() {
27 var c = get42(); 27 var c = get42();
28 int index = 0; 28 int index = 0;
29 while (true) { 29 while (true) {
30 while (index++ != 2) { 30 while (index++ != 2) {
31 var e = getNonInt(); 31 var e = getNonInt();
32 Expect.equals(42, e + 2); 32 Expect.equals(42, e + 2);
33 if (e !== null) continue; 33 if (e != null) continue;
34 } 34 }
35 // 'c' must have been saved in the environment. 35 // 'c' must have been saved in the environment.
36 Expect.equals(c, 42); 36 Expect.equals(c, 42);
37 if (c == 42) break; 37 if (c == 42) break;
38 } 38 }
39 } 39 }
40 40
41 void testInNestedWhileLoop2() { 41 void testInNestedWhileLoop2() {
42 var c = get42(); 42 var c = get42();
43 int index = 0; 43 int index = 0;
44 L0: while (index++ != 2) { 44 L0: while (index++ != 2) {
45 while (true) { 45 while (true) {
46 var e = getNonInt(); 46 var e = getNonInt();
47 Expect.equals(42, e + 2); 47 Expect.equals(42, e + 2);
48 if (e !== null) continue L0; 48 if (e != null) continue L0;
49 while (true) use(e); 49 while (true) use(e);
50 } 50 }
51 } 51 }
52 // 'c' must have been saved in the environment. 52 // 'c' must have been saved in the environment.
53 Expect.equals(c, 42); 53 Expect.equals(c, 42);
54 } 54 }
55 55
56 void testInNestedWhileLoop3() { 56 void testInNestedWhileLoop3() {
57 var c = get42(); 57 var c = get42();
58 int index = 0; 58 int index = 0;
59 while (index < 2) { 59 while (index < 2) {
60 while (index < 2) { 60 while (index < 2) {
61 var e = getNonInt(); 61 var e = getNonInt();
62 Expect.equals(42, e + 2); 62 Expect.equals(42, e + 2);
63 if (e !== null && index++ == 0) continue; 63 if (e != null && index++ == 0) continue;
64 // 'c' must have been saved in the environment. 64 // 'c' must have been saved in the environment.
65 Expect.equals(c, 42); 65 Expect.equals(c, 42);
66 while (e === null) use(e); 66 while (e == null) use(e);
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 void testInDoWhileLoop() { 71 void testInDoWhileLoop() {
72 var c = get42(); 72 var c = get42();
73 int index = 0; 73 int index = 0;
74 do { 74 do {
75 var e = getNonInt(); 75 var e = getNonInt();
76 Expect.equals(42, e + 2); 76 Expect.equals(42, e + 2);
77 if (e !== null) continue; 77 if (e != null) continue;
78 while (true) use(e); 78 while (true) use(e);
79 } while (index++ != 2); 79 } while (index++ != 2);
80 // 'c' must have been saved in the environment. 80 // 'c' must have been saved in the environment.
81 Expect.equals(c, 42); 81 Expect.equals(c, 42);
82 } 82 }
83 83
84 void testInForLoop() { 84 void testInForLoop() {
85 var c = get42(); 85 var c = get42();
86 for (int i = 0; i < 10; i++) { 86 for (int i = 0; i < 10; i++) {
87 var e = getNonInt(); 87 var e = getNonInt();
88 Expect.equals(42, e + 2); 88 Expect.equals(42, e + 2);
89 if (e !== null) continue; 89 if (e != null) continue;
90 while (true) use(e); 90 while (true) use(e);
91 } 91 }
92 // 'c' must have been saved in the environment. 92 // 'c' must have been saved in the environment.
93 Expect.equals(c, 42); 93 Expect.equals(c, 42);
94 } 94 }
95 95
96 main() { 96 main() {
97 testInWhileLoop(); 97 testInWhileLoop();
98 testInDoWhileLoop(); 98 testInDoWhileLoop();
99 testInForLoop(); 99 testInForLoop();
100 testInNestedWhileLoop(); 100 testInNestedWhileLoop();
101 testInNestedWhileLoop2(); 101 testInNestedWhileLoop2();
102 testInNestedWhileLoop3(); 102 testInNestedWhileLoop3();
103 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698